2

There is an existing question about why there is no unsigned integer (32 bit) and the answer was because it is not an SQL standard and the solution was using domain. Basically the answer was using a 32-bit signed integer and restricting it to a 16-bit unsigned integer range.

But what if I want an unsigned long integer (64 bit)? There do not seem to exist int9 or int16.

create domain uint8 as int16 check(value>=0 and value<18446744073709551615)

ERROR: type "int16" does not exist
SQL state: 42704

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135
  • 3
    `18446744073709551615` doesn't fit in a bigint, so you will have to use `numeric` –  Nov 27 '20 at 15:22

0 Answers0