From: | David Horwitz <Dhorwitz(at)ched(dot)uct(dot)ac(dot)za> |
---|---|
To: | |
Cc: | "'pgsql-odbc(at)postgresql(dot)org'" <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Re: Last inserted id |
Date: | 2001-11-12 09:10:09 |
Message-ID: | 3BEF91F1.259781BC@ched.uct.ac.za |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Him
> Unless I'm missing something, option B _is_ multi-user safe.
> currval() doesn't return the "current" value of the sequence (like
> "select * from my_seq" would) -- it returns the last value that
> nextval() gave that session (hence, it isn't defined until that
> session does a nextval()).
>
Actually the issue is b) is multi-user safe
*if* you have an exclusive lock on the table. If you don't it is quite
possible for a user to insert an other record between your insertion and the
currval() call
David
--
****************************************************
David Horwitz University of Cape Town
IT Officer Private Bag
Multimedia Education Group Rondebosch
7701
dhorwitz(at)ched(dot)uct(dot)ac(dot)za SOUTH AFRICA
Tel:+27 21 650 3841 Fax:+27 21 650 5045
http://www.meg.uct.ac.za
PGP key: http://www.meg.uct.ac.za/dhorwitz/david_horwitz.acs
*************************************************
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Michel POURE | 2001-11-12 09:36:03 | Re: Last inserted id |
Previous Message | Dave Page | 2001-11-12 09:06:06 | Re: Last inserted id |