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 <[EMAIL PROTECTED]>
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.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to