Re: psql sequence question - Mailing list pgsql-admin

From Ernest E Vogelsinger
Subject Re: psql sequence question
Date
Msg-id 5.1.1.6.2.20030616202213.03ce7be0@mail.vogelsinger.at
Whole thread Raw
In response to psql sequence question  (Jodi Kanter <jkanter@virginia.edu>)
List pgsql-admin
At 17:24 16.06.2003, Jodi Kanter said:
--------------------[snip]--------------------

>If I'm using transactions (not autocommit), are sequences atomic?

Yes

>In other words, after inserting a record to a table that
>uses sequence A, am I guaranteed that select last_value on
>sequence A is atomic, and cannot be interfered with by other
>transactions using that same sequence? Sequence A is used by
>several tables.

Yes. But you should use currval('seq_name') since this guarantees to return
the last value returned to the current connection. Check the recent posts -
there was a discussion on just this topic.

--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



pgsql-admin by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Error: Relation "pg_rel_check" does not exist
Next
From: Tom Lane
Date:
Subject: Re: how do I get rid of huge sorttemp files?