The following bug has been logged on the website:
Bug reference: 15071
Logged by: Yuriy Beliy
Email address: whiteman.kr@gmail.com
PostgreSQL version: 10.1
Operating system: Windows 10
Description:
PostgreSQL-specific :: type casts for lowest values of integer types are
produce "Out of range" errors:
SELECT -32768::smallint
^ERROR: smallint out of range
SELECT -2147483648::integer
^ERROR: integer out of range
SELECT -9223372036854775808::bigint
^ERROR: bigint out of range
Standard-syntax type casts are workes correctly:
SELECT cast(-32768 as smallint)
^Ok
SELECT cast(-2147483648 as integer)
^Ok
SELECT cast(-9223372036854775808 as bigint)
^Ok
For highest values (+32767, +2147483647, +9223372036854775807) - :: type
cast works correctly.