Per Postgres documentation, an integer
type is defined between -2147483648
and +2147483647
.
I thought that these boundaries were inclusive, but if I try:
select -2147483648 = -2147483648::int4
an Integer out of range error
is raised.
The upper bound seems to be casted properly:
# select 2147483647 = 2147483647::int4;
?column?
----------
t
(1 row)
And if I increase the lower bound by one it works fine as well:
# select -2147483647 = -2147483647::int4;
?column?
----------
t
(1 row)
The same result is applied to smallint
.
Is there something obvious that I'm missing here, or are lower bounds excluded for Postgres numeric types?