X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6EF4130DF3E for ; Mon, 16 Jun 2003 18:26:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 37039-07 for ; Mon, 16 Jun 2003 15:26:45 -0300 (ADT) Received: from relay11.austria.eu.net (relay11.Austria.eu.net [193.154.160.115]) by svr1.postgresql.org (Postfix) with ESMTP id 157AE30DBE5 for ; Mon, 16 Jun 2003 15:26:44 -0300 (ADT) Received: from sisyphus.vogelsinger.at (vogelsinger.at [193.154.189.26]) by relay11.austria.eu.net (8.12.9/8.12.0.Beta10) with ESMTP id h5GIQfc8007775; Mon, 16 Jun 2003 20:26:42 +0200 Message-Id: <5.1.1.6.2.20030616202213.03ce7be0@mail.vogelsinger.at> X-Sender: homebird@mail.vogelsinger.at X-Mailer: QUALCOMM Windows Eudora Version 5.1.1 Date: Mon, 16 Jun 2003 20:26:37 +0200 To: Jodi Kanter From: Ernest E Vogelsinger Subject: Re: psql sequence question Cc: Postgres Admin List In-Reply-To: <3EEDE12C.30401@virginia.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200306/177 X-Sequence-Number: 9168 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/