Re: INT8 / float casting question
От | Adrian Klaver |
---|---|
Тема | Re: INT8 / float casting question |
Дата | |
Msg-id | 5453AAEC.8050505@aklaver.com обсуждение исходный текст |
Ответ на | INT8 / float casting question (Filip Rembiałkowski <filip.rembialkowski@gmail.com>) |
Список | pgsql-sql |
On 10/31/2014 07:58 AM, Filip Rembiałkowski wrote: > psql.bin (9.3.4, server 9.3.5) > Type "help" for help. > > dev=# select (2^63-1)::INT8; > ERROR: bigint out of range > > Does it HAVE to be so? > > > http://en.wikipedia.org/wiki/9223372036854775807 It seems to be not a problem with the number but the exponentiation and casting: test=# create table bigint_test (int_fld int8); CREATE TABLE test=# insert into bigint_test values (9223372036854775807); INSERT 0 1 test=# select * from bigint_test ; int_fld --------------------- 9223372036854775807 test=# select 2^63-1; ?column? ---------------------- 9.22337203685478e+18 (1 row) test=# select (2^63-1)::int8; ERROR: bigint out of range > > > > Thanks > Filip > > -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-sql по дате отправления: