On Thu, 2005-07-07 at 15:14, Theodore Petrosky wrote: > 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.
Actually, whether you use it inside a transaction or not, as long as it's in the same session / connection, it is guaranteed to "do the right thing." Test it, you'll see. ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly