> 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