pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Sequence "self" change - possible?
4+ messages / 4 participants
[nested] [flat]

* Sequence "self" change - possible?
@ 2011-11-28 14:04  Lukasz Brodziak <lukasz.brodziak@gmail.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Lukasz Brodziak @ 2011-11-28 14:04 UTC (permalink / raw)
  To: pgsql-admin

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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Sequence "self" change - possible?
@ 2011-11-28 14:07  Szymon Guz <mabewlun@gmail.com>
  parent: Lukasz Brodziak <lukasz.brodziak@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Szymon Guz @ 2011-11-28 14:07 UTC (permalink / raw)
  To: Lukasz Brodziak <lukasz.brodziak@gmail.com>; +Cc: pgsql-admin

On 28 November 2011 15:04, Lukasz Brodziak <lukasz.brodziak@gmail.com>wrote:

> 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
>
>
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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Sequence "self" change - possible?
@ 2011-11-28 14:10  Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
  parent: Lukasz Brodziak <lukasz.brodziak@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Oliveiros d'Azevedo Cristina @ 2011-11-28 14:10 UTC (permalink / raw)
  To: Lukasz Brodziak <lukasz.brodziak@gmail.com>; pgsql-admin

Can it be that it wrapped around?

Best,
Oliveiros
  ----- Original Message ----- 
  From: Lukasz Brodziak 
  To: pgsql-admin@postgresql.org 
  Sent: Monday, November 28, 2011 2:04 PM
  Subject: [ADMIN] Sequence "self" change - possible?


  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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Sequence "self" change - possible?
@ 2011-11-29 02:37  Craig Ringer <ringerc@ringerc.id.au>
  parent: Lukasz Brodziak <lukasz.brodziak@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Craig Ringer @ 2011-11-29 02:37 UTC (permalink / raw)
  To: Lukasz Brodziak <lukasz.brodziak@gmail.com>; +Cc: pgsql-admin

On 11/28/2011 10:04 PM, Lukasz Brodziak wrote:
> 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.

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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-11-29 02:37 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28 14:04 Sequence "self" change - possible? Lukasz Brodziak <lukasz.brodziak@gmail.com>
2011-11-28 14:07 ` Szymon Guz <mabewlun@gmail.com>
2011-11-28 14:10 ` Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
2011-11-29 02:37 ` Craig Ringer <ringerc@ringerc.id.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox