Tuesday, 15 March 2011

postgresql - integer out of range -



postgresql - integer out of range -

not slightest thought why hell happening..

i've set table accordingly:

create table raw ( id serial, regtime float not null, time float not null, source varchar(15), sourceport integer, destination varchar(15), destport integer, blocked boolean ); ... + index , grants

i've used table while now, , of sudden next insert doesn't work longer..

insert raw( time, regtime, blocked, destport, sourceport, source, destination ) values ( 1403184512.2283964, 1403184662.118, false, 2, 3, '192.168.0.1', '192.168.0.2' );

the error is: error: integer out of rage

i mean comon... not sure begin debugging this.. i'm not out of disk-space , error kinda discreet..

serial columns stored integers, giving them maximum value of 231-1. after ~2 billion inserts, new id values no longer fit.

if expect many inserts on life of table, create bigserial (internally bigint, maximum of 263-1).

if find later on serial isn't big enough, can increment size of existing field with:

alter table raw alter column id type bigint;

note it's bigint here, rather bigserial (as serials aren't real types). , maintain in mind that, if have 2 billion records in table, might take little while...

postgresql integer runtime-error

No comments:

Post a Comment