Re: Bug? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Bug?
Date
Msg-id 20011115145844.F10930-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: Bug?  ("Andrew G. Hammond" <drew@xyzzy.dhs.org>)
List pgsql-general
> Is this correct behaviour?  ACID compliant?  The argument in it's favour it
> pretty obvious: if you never go backwards then you'll never get an accidental
> duplication as follows:
>
> t1 BEGIN; SELECT nextval('test_id_seq')    # 1
> t2 SELECT nextval('test_id_seq')        # 2
> t1 ROLLBACK                 # test_id_seq decremented
> t3 SELECT nextval('test_id_seq')        # 2
>
> However wouldn't locking the sequence be more proper behaviour?

That's the intended behavior.  Sequences aren't defined to give sequential
values, merely unique ones across their output set.  The point is to
prevent two insert transactions from blocking on each other trying to get
the sequence value.




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Delete performance
Next
From: Doug McNaught
Date:
Subject: Re: Bug?