Gah, this is getting a bit annoying, correcting this bit of
mis-information.

currval() is kept as part of the session context, as is completely
multi-user safe. That's why the person you quoted said 'in the same
session'.

Where is everyone coming up with the wrong idea on this? Is there a
major commercial DB with sequence objects that gets this wrong?

Ross
-- 
Ross J. Reedstrom, Ph.D., <[EMAIL PROTECTED]> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



On Thu, Dec 09, 1999 at 10:36:40AM -0000, Dev Elop wrote:
> > >
> > > After an INSERT, I want to retrieve the value of the sequence I use for
> > > unique_ids
> > >
> ...
> >
> > Alternatively, use the currval(mytable_id_seq) function within the same
> > session immediately after the insert.
> >
> With this second method, you'd probably need to beware race conditions. If
> another process inserts a record into mytable after you do but before you
> call currval(), then you'll get the wrong value.
> 
> Not an issue if you've only got one process accessing the table - probably
> is one if you have two or more.
> 
> -
>   Richard Huxton
> 
> 
> ************
> 

************

Reply via email to