Last Id? - Mailing list pgsql-novice

From Jan Danielsson
Subject Last Id?
Date
Msg-id 431B368B.6010109@gmail.com
Whole thread Raw
Responses Re: Last Id?
Re: Last Id?
List pgsql-novice
Hello all,

   I know how do do this in IBM DB2 and MySQL, but now my interrest has
shifted towards postgresql; I need to be able to insert a row, and find
out which id it was assigned. (I'm talking about using sequences here).

   I have seen a few "currval", "last_value", tricks and such, but they
aren't good enough, AFAICT, since they only work when I can guarantee
that no one else will insert a new record between the time that I insert
one, and query for the last_value.

   In IBM DB2 and MySQL there's a connection specific "last id" value
which can be queried. I assume there's something similar in postgresql
-- but what is it?

--
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.

Attachment

pgsql-novice by date:

Previous
From: bob_a@xypro.com
Date:
Subject: ERROR: 42P01: relation "
Next
From: "Toff"
Date:
Subject: Inserting data in other db