Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ADMIN] Sequence "self" change - possible?

2 views
Skip to first unread message

Lukasz Brodziak

unread,
Nov 28, 2011, 9:04:10 AM11/28/11
to
Hello,

Is it possible for sequence to decrement its value by itself? Or is it possible to see wether it was changed by someone. The thing is that on one of our clinet's DB sequence rolled back to the state from 8 months ago.

--
Łukasz Brodziak

Szymon Guz

unread,
Nov 28, 2011, 9:07:44 AM11/28/11
to
Hi Łukasz,

you can have set the sequence as cycled (http://www.postgresql.org/docs/current/static/sql-createsequence.html) so it can set automatically to minvalue when reaching maxvalue.

Show us the definition of that sequence.

regards
Szymon

Oliveiros d'Azevedo Cristina

unread,
Nov 28, 2011, 9:10:26 AM11/28/11
to
Can it be that it wrapped around?
 
Best,
Oliveiros

Craig Ringer

unread,
Nov 28, 2011, 9:37:54 PM11/28/11
to
It shouldn't generally be possible, no. It'd have to be changed by a
call to nextval(), setval() or the like, or a direct UPDATE to the
underlying sequence pseudo-table.

Could someone have tried to restore a backup from 8 months ago? That'd
result in a setval(...) call when pg_restore or psql (depending on
backup format) tried to set the sequence position.

In your case, though, your next post mentions possible database
corruption, so I'm wondering if this is related. If something's been
scribbling over the database files, someone's half-restored an old
file-level backup, or something similarly horrible then anything could
happen.

--
Craig Ringer


--
Sent via pgsql-admin mailing list (pgsql...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

0 new messages