RE: [INTERFACES] locking on database updates

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: "'dougt(at)mugc(dot)cc(dot)monash(dot)edu(dot)au'" <dougt(at)mugc(dot)cc(dot)monash(dot)edu(dot)au>
Cc: "'Pgsql Interfaces'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: [INTERFACES] locking on database updates
Date: 1999-12-07 12:21:11
Message-ID: 01BF40AD.8CF130C0@garys.ringways.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


-----Original Message-----
From: Douglas Thomson [SMTP:dougt(at)mugc(dot)cc(dot)monash(dot)edu(dot)au]
Sent: Tuesday, December 07, 1999 11:16 AM
To: Gary Stainburn
Subject: Re: [INTERFACES] locking on database updates

!> Is there any way to easily retrieve the sequence number just created =
!> without having the same contension problems I originally wanted to =
!> avoid?
!
!Do you need to find out the next value that will be used before you
!use it? If so there may be a problem...
!
!However, if you only need to do inserts and find out afterwards what
!sequence number got used then there is no problem. Postgres looks
!after making sure multiple simultaneous backend processes don't
!duplicate sequence numbers. I think it actually reserves a few
!numbers in the sequence for each process, so it is possible to get
!small gaps in the sequence, or for the sequence numbers to be not
!strictly chronological...
!
!As for the how - well, I simply selected back the row I had just
!inserted to extract the sequence number column :-)
!
!Doug.

It's not important that I know the number beforehand. However, as
this is the only field that is guaranteed to be unique, getting the
sequence number using a select statement may not work.
It doesn't matter
-----------------------------------------
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 thing about standards is that there are so many of them to choose from. -- Andrew S. Tanenbaum
-----------------------------------------

Browse pgsql-interfaces by date

  From Date Subject
Next Message Gary Stainburn 1999-12-07 16:34:37 RE: [INTERFACES] locking on database updates
Previous Message Karel Zak - Zakkr 1999-12-07 12:00:10 Re: [INTERFACES] Spanish format on date and numbers