Type and CAST error on lowest negative integer values for smallint, int and bigint

Поиск
Список
Период
Сортировка
От Hans Buschmann
Тема Type and CAST error on lowest negative integer values for smallint, int and bigint
Дата
Msg-id 5795b386f0644faf92aa63de3694923b@nidsa.net
обсуждение исходный текст
Ответы Re: Type and CAST error on lowest negative integer values for smallint, int and bigint
Список pgsql-hackers

I tried to initialize a table with values for smallint columns.

The final goal is to get mask values for logical operations.


The insert failed with ERROR: smallint out of range.


the same occurs when using a simple select statement like:

select -32768::smallint;
select -2147483648::int;
select -9223372036854775808::bigint;

These limit values are taken from the documentation 8.1.1 Integer Types

This occurs on PG16.2 on Windows or Linux (64bit).

This prevents me to enter the binary value 0b10000000_00000000 into a smallint column
(I could use some other tricks, but this is ugly!)

-----------

postgres=# select version ();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 16.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0), 64-bit
(1 Zeile)

postgres=# select -32768::smallint;
ERROR:  smallint out of range

Thank you for looking


Hans Buschmann

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jelte Fennema-Nio
Дата:
Сообщение: Re: Reducing the log spam
Следующее
От: David Rowley
Дата:
Сообщение: Re: Type and CAST error on lowest negative integer values for smallint, int and bigint