From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Ash Grove <ash_grv7(at)yahoo(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: is an explicit lock necessary? |
Date: | 2006-05-04 18:50:24 |
Message-ID: | 20060504114708.I61331@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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).
From | Date | Subject | |
---|---|---|---|
Next Message | Ragnar | 2006-05-04 18:59:58 | Re: is an explicit lock necessary? |
Previous Message | Andrew Sullivan | 2006-05-04 18:47:48 | Re: is an explicit lock necessary? |