Skip site navigation (1) Skip section navigation (2)

RE: [INTERFACES] locking on database updates

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'Pgsql Interfaces'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: [INTERFACES] locking on database updates
Date: 1999-12-07 19:36:41
Message-ID: 01BF40EA.63E2DC00@garys.ringways.co.uk (view raw or flat)
Thread:
Lists: pgsql-interfaces
-----Original Message-----
From:	Tom Lane [SMTP:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent:	Tuesday, December 07, 1999 6:00 PM
To:	Ross J. Reedstrom
Cc:	Gary Stainburn; 'Pgsql Interfaces'
Subject:	Re: [INTERFACES] locking on database updates 

|"Ross J. Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu> writes:
|> create table foo (bar serial, baz text);
|> insert into foo (baz) values ('wooble');
|> select currval('foo_bar_seq');
|
|I don't think this is safe in a multi-client environment;
|what if someone else inserts at about the same time?
|
|Better to do
|	select nextval('foo_bar_seq');
|	insert into foo values (just-retrieved-value, 'wooble');
|which is safer and probably marginally faster (since the
|sequence object is touched only once, not twice).
|
|			regards, tom lane

Perfect - exactly what I need. Another fine day at the office.
-----------------------------------------
Gary Stainburn.
Work: http://www.ringways.co.uk gary(dot)stainburn(at)ringways(dot)co(dot)uk
REVCOM: http://www.revcom.dhs.org http://www.revcom.org.uk gary(dot)stainburn(at)revcom(dot)org(dot)uk
-----------------------------------------
The nice ones are always taken - anon
-----------------------------------------


pgsql-interfaces by date

Next:From: Christian HangDate: 1999-12-07 21:53:58
Subject: ODBC and Large Objects, FAQ not working
Previous:From: Joseph ShraibmanDate: 1999-12-07 19:36:16
Subject: Re: [INTERFACES] locking on database updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group