pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Lukasz Brodziak <lukasz.brodziak@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Sequence "self" change - possible?
Date: Tue, 29 Nov 2011 10:37:54 +0800
Message-ID: <4ED44582.4080306@ringerc.id.au> (raw)
In-Reply-To: <CAGWYGjVR6bwNpAwFRF-_NRP1fwFZCDWspyxLH58y--uW7ZPiHA@mail.gmail.com>
References: <CAGWYGjVR6bwNpAwFRF-_NRP1fwFZCDWspyxLH58y--uW7ZPiHA@mail.gmail.com>

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




view thread (4+ messages)

Message-ID: <4ED44582.4080306@ringerc.id.au>
Permalink:  ../4ED44582.4080306@ringerc.id.au/
Also on:    postgresql.org/message-id/4ED44582.4080306@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ringerc@ringerc.id.au, lukasz.brodziak@gmail.com
  Subject: Re: Sequence "self" change - possible?
  In-Reply-To: <4ED44582.4080306@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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