If you are using transactions (as you probably should be) you can use
curval to get the last assigned value I believe. Something like:
insert into table (field) values ('val');
select curval(seq_name);
I just wrote something similar in PHP that reads back the OID of the insert
and then does a select fieldname from table where oid = last_oid; which
also works well. I believe there are ways to access the oid of your insert
from all of the languages with Postgres support.
At 05:40 PM 9/20/99, David Giffin wrote:
>
>Is there a way to tell what nextval('sequencename') returned? I have been
>doing a seperate query to get it. But in production this would lead to
>race conditions.
>
>Thanks,
>
>David
>
>
>************
>