From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Ash Grove <ash_grv7@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: is an explicit lock necessary?
Date: Thu, 4 May 2006 11:50:24 -0700 (PDT)
Message-ID: <20060504114708.I61331@megazone.bigpanda.com> (raw)
In-Reply-To: <20060504181056.14509.qmail@web52510.mail.yahoo.com>
References: <20060504181056.14509.qmail@web52510.mail.yahoo.com>
On Thu, 4 May 2006, Ash Grove wrote:
> Hi,
>
> Does beginning a transaction put locks on the tables
> queried within the transaction?
>
> In the example below, is #2 necessary? My thought was
> that I would need to use an explicit lock to make sure
> that the sequence value I'm selecting in #4 is the
> same one that is generated from #3. I'm worried about
> another instance of the application doing an insert on
> table1 between #3 and #4.
If you have 1 session per instance and #3 and #4 are done after each
other without any intervening commands, the behavior of nextval/currval
should guarantee that (currval gives the value from this session's
nextval, not any other).
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, ash_grv7@yahoo.com
Subject: Re: is an explicit lock necessary?
In-Reply-To: <20060504114708.I61331@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox