On Thu, Oct 18, 2001 at 10:29:09AM -0400, Bruce Cota wrote:
> Thank you!
>
> Hopefully that getlastoid refers to the last oid
> created in this session or transaction? I can't find it
> mentioned in the docs anywhwere.
last insert, iirc.
> Nextval and curval aren't specific to the transaction or
> session, right? so that would be problematic in a
> multi-user environment.
Sure they are. Currval returns the last value returned in this transaction.
This is a production database system and not having it multiuser safe would
be stupid no?
So you can do stuff like:
insert into invoice (customer,date,etc...);
insert into item (invoice_id, ...) values ( currval('invoice_id_seq'), ... );
etc...
multiuser safe. very cool. Remember, oid are not really guarenteed to be
unique...
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.