Re: SERIAL behaviour - Mailing list pgsql-general

From Christoph Dalitz
Subject Re: SERIAL behaviour
Date
Msg-id 20020715151004.707cc9ea.christoph.dalitz@hs-niederrhein.de
Whole thread Raw
In response to SERIAL behaviour  (Eugene <foo@bar.com>)
List pgsql-general
> However, I am quite dismayed by the behavior of the
> SERIAL type, or, more specifically, the PostgreSQL sequences.
>
> The problem is that on a rollback, the value of the sequence does not go
> back to its previous value!
>
If I understand SEQUENCEs right, that should be the expected behaviour:
Sequences generate values that are unique both in space (ie. other users/transactions)
and time. Thus they must not be rescrewed in case of ROLLBACK.

> Also, how can I ensure
> consistency when multiple clients are changing the same tables? (sequence
> doesn't seem to be part of the transaction...)
>
That sequences are not "part of the transaction" actually guarantees
consistency among multiple clients.

Christoph Dalitz

pgsql-general by date:

Previous
From: Steve Brett
Date:
Subject: Re: SERIAL behaviour
Next
From: Jan Wieck
Date:
Subject: Re: I am being interviewed by OReilly