create schema uint_add;
set current_schema to 'uint_add';
--uint8
select 18446744073709551615::uint8 + 0::int1;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::int2;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::int4;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::int8;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::uint1;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::uint2;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::uint4;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 0::uint8;
?column?
----------------------
18446744073709551615
(1 row)
select 18446744073709551615::uint8 + 1::int1;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::int2;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::int4;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::int8;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::uint1;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::uint2;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::uint4;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + 1::uint8;
ERROR: bigint unsigned out of range
select 18446744073709551615::uint8 + null::int1;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::int2;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::int4;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::int8;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::uint1;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::uint2;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::uint4;
?column?
----------
(1 row)
select 18446744073709551615::uint8 + null::uint8;
?column?
----------
(1 row)
select 1::uint8 + (-1)::int2;
?column?
----------
0
(1 row)
select 1::uint8 + (-1)::int4;
?column?
----------
0
(1 row)
select 1::uint8 + (-1)::int8;
?column?
----------
0
(1 row)
select 1::uint8 + (-2)::int2;
ERROR: bigint unsigned out of range
select 1::uint8 + (-2)::int4;
ERROR: bigint unsigned out of range
select 1::uint8 + (-2)::int8;
ERROR: bigint unsigned out of range
--uint4
select 4294967295::uint4 + 0::int1;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::int2;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::int4;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::int8;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::uint1;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::uint2;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::uint4;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 0::uint8;
?column?
------------
4294967295
(1 row)
select 4294967295::uint4 + 1::int1;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::int2;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::int4;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::int8;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::uint1;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::uint2;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::uint4;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + 1::uint8;
?column?
------------
4294967296
(1 row)
select 4294967295::uint4 + null::int1;
?column?
----------
(1 row)
select 4294967295::uint4 + null::int2;
?column?
----------
(1 row)
select 4294967295::uint4 + null::int4;
?column?
----------
(1 row)
select 4294967295::uint4 + null::int8;
?column?
----------
(1 row)
select 4294967295::uint4 + null::uint1;
?column?
----------
(1 row)
select 4294967295::uint4 + null::uint2;
?column?
----------
(1 row)
select 4294967295::uint4 + null::uint4;
?column?
----------
(1 row)
select 4294967295::uint4 + null::uint8;
?column?
----------
(1 row)
select 4294967295::uint4 + 9223372036854775807::int8;
?column?
---------------------
9223372041149743102
(1 row)
select 4294967295::uint4 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
select 1::uint4 + (-1)::int2;
?column?
----------
0
(1 row)
select 1::uint4 + (-1)::int4;
?column?
----------
0
(1 row)
select 1::uint4 + (-1)::int8;
?column?
----------
0
(1 row)
select 1::uint4 + (-2)::int2;
ERROR: bigint unsigned out of range
select 1::uint4 + (-2)::int4;
ERROR: bigint unsigned out of range
select 1::uint4 + (-2)::int8;
ERROR: bigint unsigned out of range
--uint2
select 65535::uint2 + 0::int1;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::int2;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::int4;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::int8;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::uint1;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::uint2;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::uint4;
?column?
----------
65535
(1 row)
select 65535::uint2 + 0::uint8;
?column?
----------
65535
(1 row)
select 65535::uint2 + 1::int1;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::int2;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::int4;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::int8;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::uint1;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::uint2;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::uint4;
?column?
----------
65536
(1 row)
select 65535::uint2 + 1::uint8;
?column?
----------
65536
(1 row)
select 65535::uint2 + null::int1;
?column?
----------
(1 row)
select 65535::uint2 + null::int2;
?column?
----------
(1 row)
select 65535::uint2 + null::int4;
?column?
----------
(1 row)
select 65535::uint2 + null::int8;
?column?
----------
(1 row)
select 65535::uint2 + null::uint1;
?column?
----------
(1 row)
select 65535::uint2 + null::uint2;
?column?
----------
(1 row)
select 65535::uint2 + null::uint4;
?column?
----------
(1 row)
select 65535::uint2 + null::uint8;
?column?
----------
(1 row)
select 65535::uint2 + 2147483647::int4;
?column?
------------
2147549182
(1 row)
select 65535::uint2 + 9223372036854775807::int8;
?column?
---------------------
9223372036854841342
(1 row)
select 65535::uint2 + 4294967295::uint4;
?column?
------------
4295032830
(1 row)
select 65535::uint2 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
select 1::uint2 + (-1)::int2;
?column?
----------
0
(1 row)
select 1::uint2 + (-1)::int4;
?column?
----------
0
(1 row)
select 1::uint2 + (-1)::int8;
?column?
----------
0
(1 row)
select 1::uint2 + (-2)::int2;
ERROR: int unsigned out of range
select 1::uint2 + (-2)::int4;
ERROR: bigint unsigned out of range
select 1::uint2 + (-2)::int8;
ERROR: bigint unsigned out of range
--uint1
select 255::uint1 + 0::int1;
?column?
----------
255
(1 row)
select 255::uint1 + 0::int2;
?column?
----------
255
(1 row)
select 255::uint1 + 0::int4;
?column?
----------
255
(1 row)
select 255::uint1 + 0::int8;
?column?
----------
255
(1 row)
select 255::uint1 + 0::uint1;
?column?
----------
255
(1 row)
select 255::uint1 + 0::uint2;
?column?
----------
255
(1 row)
select 255::uint1 + 0::uint4;
?column?
----------
255
(1 row)
select 255::uint1 + 0::uint8;
?column?
----------
255
(1 row)
select 255::uint1 + 1::int1;
?column?
----------
256
(1 row)
select 255::uint1 + 1::int2;
?column?
----------
256
(1 row)
select 255::uint1 + 1::int4;
?column?
----------
256
(1 row)
select 255::uint1 + 1::int8;
?column?
----------
256
(1 row)
select 255::uint1 + 1::uint1;
?column?
----------
256
(1 row)
select 255::uint1 + 1::uint2;
?column?
----------
256
(1 row)
select 255::uint1 + 1::uint4;
?column?
----------
256
(1 row)
select 255::uint1 + 1::uint8;
?column?
----------
256
(1 row)
select 255::uint1 + null::int1;
?column?
----------
(1 row)
select 255::uint1 + null::int2;
?column?
----------
(1 row)
select 255::uint1 + null::int4;
?column?
----------
(1 row)
select 255::uint1 + null::int8;
?column?
----------
(1 row)
select 255::uint1 + null::uint1;
?column?
----------
(1 row)
select 255::uint1 + null::uint2;
?column?
----------
(1 row)
select 255::uint1 + null::uint4;
?column?
----------
(1 row)
select 255::uint1 + null::uint8;
?column?
----------
(1 row)
select 255::uint1 + 32767::int2;
?column?
----------
33022
(1 row)
select 255::uint1 + 2147483647::int4;
?column?
------------
2147483902
(1 row)
select 255::uint1 + 9223372036854775807::int8;
?column?
---------------------
9223372036854776062
(1 row)
select 255::uint1 + 65535::uint2;
?column?
----------
65790
(1 row)
select 255::uint1 + 4294967295::uint4;
?column?
------------
4294967550
(1 row)
select 255::uint1 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
select 1::uint1 + (-1)::int2;
?column?
----------
0
(1 row)
select 1::uint1 + (-1)::int4;
?column?
----------
0
(1 row)
select 1::uint1 + (-1)::int8;
?column?
----------
0
(1 row)
select 1::uint1 + (-2)::int2;
ERROR: int unsigned out of range
select 1::uint1 + (-2)::int4;
ERROR: bigint unsigned out of range
select 1::uint1 + (-2)::int8;
ERROR: bigint unsigned out of range
--int8
select 9223372036854775807::int8 + 0::uint1;
?column?
---------------------
9223372036854775807
(1 row)
select 9223372036854775807::int8 + 0::uint2;
?column?
---------------------
9223372036854775807
(1 row)
select 9223372036854775807::int8 + 0::uint4;
?column?
---------------------
9223372036854775807
(1 row)
select 9223372036854775807::int8 + 0::uint8;
?column?
---------------------
9223372036854775807
(1 row)
select 9223372036854775807::int8 + 1::uint1;
?column?
---------------------
9223372036854775808
(1 row)
select 9223372036854775807::int8 + 1::uint2;
?column?
---------------------
9223372036854775808
(1 row)
select 9223372036854775807::int8 + 1::uint4;
?column?
---------------------
9223372036854775808
(1 row)
select 9223372036854775807::int8 + 1::uint8;
?column?
---------------------
9223372036854775808
(1 row)
select 9223372036854775807::int8 + null::uint1;
?column?
----------
(1 row)
select 9223372036854775807::int8 + null::uint2;
?column?
----------
(1 row)
select 9223372036854775807::int8 + null::uint4;
?column?
----------
(1 row)
select 9223372036854775807::int8 + null::uint8;
?column?
----------
(1 row)
select 9223372036854775807::int8 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
--int4
select 2147483647::int4 + 0::uint1;
?column?
------------
2147483647
(1 row)
select 2147483647::int4 + 0::uint2;
?column?
------------
2147483647
(1 row)
select 2147483647::int4 + 0::uint4;
?column?
------------
2147483647
(1 row)
select 2147483647::int4 + 0::uint8;
?column?
------------
2147483647
(1 row)
select 2147483647::int4 + 1::uint1;
?column?
------------
2147483648
(1 row)
select 2147483647::int4 + 1::uint2;
?column?
------------
2147483648
(1 row)
select 2147483647::int4 + 1::uint4;
?column?
------------
2147483648
(1 row)
select 2147483647::int4 + 1::uint8;
?column?
------------
2147483648
(1 row)
select 2147483647::int4 + null::uint1;
?column?
----------
(1 row)
select 2147483647::int4 + null::uint2;
?column?
----------
(1 row)
select 2147483647::int4 + null::uint4;
?column?
----------
(1 row)
select 2147483647::int4 + null::uint8;
?column?
----------
(1 row)
select 2147483647::int4 + 4294967295::uint4;
?column?
------------
6442450942
(1 row)
select 2147483647::int4 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
--int2
select 32767::int2 + 0::uint1;
?column?
----------
32767
(1 row)
select 32767::int2 + 0::uint2;
?column?
----------
32767
(1 row)
select 32767::int2 + 0::uint4;
?column?
----------
32767
(1 row)
select 32767::int2 + 0::uint8;
?column?
----------
32767
(1 row)
select 32767::int2 + 1::uint1;
?column?
----------
32768
(1 row)
select 32767::int2 + 1::uint2;
?column?
----------
32768
(1 row)
select 32767::int2 + 1::uint4;
?column?
----------
32768
(1 row)
select 32767::int2 + 1::uint8;
?column?
----------
32768
(1 row)
select 32767::int2 + null::uint1;
?column?
----------
(1 row)
select 32767::int2 + null::uint2;
?column?
----------
(1 row)
select 32767::int2 + null::uint4;
?column?
----------
(1 row)
select 32767::int2 + null::uint8;
?column?
----------
(1 row)
select 32767::int2 + 65535::uint2;
?column?
----------
98302
(1 row)
select 32767::int2 + 4294967295::uint4;
?column?
------------
4295000062
(1 row)
select 32767::int2 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
--int1
select 127::int1 + 0::uint1;
?column?
----------
127
(1 row)
select 127::int1 + 0::uint2;
?column?
----------
127
(1 row)
select 127::int1 + 0::uint4;
?column?
----------
127
(1 row)
select 127::int1 + 0::uint8;
?column?
----------
127
(1 row)
select 127::int1 + 1::uint1;
?column?
----------
128
(1 row)
select 127::int1 + 1::uint2;
?column?
----------
128
(1 row)
select 127::int1 + 1::uint4;
?column?
----------
128
(1 row)
select 127::int1 + 1::uint8;
?column?
----------
128
(1 row)
select 127::int1 + null::uint1;
?column?
----------
(1 row)
select 127::int1 + null::uint2;
?column?
----------
(1 row)
select 127::int1 + null::uint4;
?column?
----------
(1 row)
select 127::int1 + null::uint8;
?column?
----------
(1 row)
select 127::int1 + 65535::uint2;
?column?
----------
65662
(1 row)
select 127::int1 + 4294967295::uint4;
?column?
------------
4294967422
(1 row)
select 127::int1 + 18446744073709551615::uint8;
ERROR: bigint unsigned out of range
drop schema uint_add cascade;
reset current_schema;