Re: psql sequence question

From: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
To: Jodi Kanter <jkanter(at)virginia(dot)edu>
Cc: Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: psql sequence question
Date: 2003-06-16 18:26:37
Message-ID: 5.1.1.6.2.20030616202213.03ce7be0@mail.vogelsinger.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message scott.marlowe 2003-06-16 19:06:59 Re: Run 4 postgresql session on ONE server?
Previous Message Stephan Szabo 2003-06-16 17:14:36 Re: Error: Relation "pg_rel_check" does not exist