Re: BUG #2290: Incorrect sequence increment after backup/restore - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2290: Incorrect sequence increment after backup/restore
Date
Msg-id 15341.1141142266@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2290: Incorrect sequence increment after backup/restore  ("Oleg Mamontov" <oleg@mamontov.net>)
Responses Re: BUG #2290: Incorrect sequence increment after backup/restore  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
"Oleg Mamontov" <oleg@mamontov.net> writes:
> If after CREATE TABLE with SERIAL column i'll change sequence increment to 2
> or some other value (with ALTER SEQUENCE) then always work correctly (all
> inserted rows will have values incremented by 2).

We currently consider that a serial column is a "black box" and you
should not mess with its underlying sequence directly.  If you want
nondefault properties for the sequence, create it as an independent
sequence object and then just declare the column as "integer
default nextval('seq')".

            regards, tom lane

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: BUG #2289: insert into tables not working
Next
From: Bruce Momjian
Date:
Subject: Re: FATAL: semctl(1672698088, 12, SETVAL, 0) failed