Re: problem in sequence - Mailing list pgsql-admin

From Jason Minion
Subject Re: problem in sequence
Date
Msg-id 261CF9EEB14F5442894AB6DDA93AA6F40758EF@mail.siglercompanies.com
Whole thread Raw
In response to problem in sequence  ("Suvarna" <suvarnat@cygnus.stpp.soft.net>)
List pgsql-admin
This is likely because transactions have been rolled back due to the
shutdown. Sequences operate *outside* of transaction space - operations
on a sequence will not be rolled back from a transaction, and a commit
has no effect. There is probably a better way to put that. However, they
should not be used when sequential numbers are necessary. Notice that
you can use functions on the same sequence across multiple transactions
concurrently, a lock is only necessary during the execution of the
function, not the transaction. If you do need distinct sequential number
generation, I would suggest an AFTER INSERT trigger that determines the
next value necessary. You would also need to lock the table
appropriately in that trigger. There will be performance penalties for
this.

You should also update/upgrade your PostgreSQL installation!!

Please see:

http://www.postgresql.org/docs/8.1/interactive/sql-createsequence.html


Jason Minion



________________________________

From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Suvarna
Sent: Monday, February 27, 2006 11:51 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] problem in sequence


In postgresql 7.3.2 if the server shuts down abruptly then sequence does
not behave properly.
Next val after rebooting server shows gsp between last number & next val

pgsql-admin by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Reg:lo_open error..pls help me
Next
From: "Jim C. Nasby"
Date:
Subject: Re: REINDEX during a transaction