I'm discovering a new world with PostgreSQL but while transefering a Firebird 2.1 database to PostgreSQL 9.3 i've encountered folowing error
BIGINT out of range:
I've checked the Min and Max values from import statement and they fit in Bigint and could imported, but the whole insert statement in the attachment gives me error. I've also reporduced the error in PGAdmin.
Table have following structure:
CREATE TABLE SomeTable
(
id integer NOT NULL
n0 bigint NOT NULL DEFAULT 0,
n1 bigint NOT NULL DEFAULT 0,
n2 bigint NOT NULL DEFAULT 0,
n3 bigint NOT NULL DEFAULT 0
.
.
.
n247 bigint NOT NULL DEFAULT 0,
CONSTRAINT SomeTable_pkey PRIMARY KEY (id)
)
File with actual insert statement and table structure, also extracted values
Any suggestions ?
ACTUAL ERROR ERROR: bigint out of range *** Error ***
ERROR: bigint out of range SQL state: 22003
UPDATE I`m using statements in this form
insert .... values ((1::int4),(2222222222::int8)....);
when changed it to
insert .... values (1,2222222222,....);
It works. It seems to me like a litle bug in Postgres.
UPDATE
The query is form from NPGSQL 2.0 prepared statement. in version 2.1 the issue is fixed and works fine NPGSQL bug tracker with the issue
This value in your SQL Fiddle example is out of range :
select -9223372036854775808::int8;
ERROR: bigint out of range
The problem is that it first tries to convert 9223372036854775808
to bigint to only then change its sign. It works if you do
select (-9223372036854775808)::bigint;
int8
----------------------
-9223372036854775808