you have to use currval inside a transaction... begin; insert something that increments the counter; select currval('sequence_name'); end;
using currval inside a transaction guarantees that the value is correct for your insert statement and has not changed by another insert statement. Ted --- mail TechEvolution <[EMAIL PROTECTED]> wrote: > hello > > i ame a newbie to PostGreSQL, I ame using PostGreSQL > 8.0 > (windowsinstaller) on a xp prof platform > > i would like to get back the autonumber from the > last record inserted, > for other SQL db (m$ sql db ...) i could use: > SELECT @@ IDENTITY > > can someone help me by informing me what the SQL > syntax is to be used > with PostGreSQL db and get the same result, the last > autonumber inserted? > > greeTz > > wes > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > ____________________________________________________ Sell on Yahoo! Auctions no fees. Bid on great items. http://auctions.yahoo.com/ ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])