elein <elein@varlena.com> writes:
> But shouldn't it wrap when it hits the max?
No, absolutely not. The default sequence behavior is NO CYCLE, meaning
you'll start getting errors from nextval() when you reach the max.
I don't see a lot of difference between getting that error and getting
an int8-to-int4 conversion error.
If someone actually wants wrapping in a serial column, they can adjust
the sequence CYCLE parameter with ALTER SEQUENCE, and fix the maxval
to be what they want at the same time.
Memo to whoever feels like hacking on pg_dump: I believe that any such
manual adjustment to a serial sequence's parameters would be lost over a
dump-n-restore, since pg_dump doesn't emit any CREATE SEQUENCE for it.
Maybe we need an ALTER SEQUENCE in there instead.
regards, tom lane