| From: | Jan Danielsson <jan(dot)danielsson(at)gmail(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Last Id? |
| Date: | 2005-09-04 18:01:47 |
| Message-ID: | 431B368B.6010109@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-09-04 22:45:57 | Re: UPDATE: pg_dump fails due to invalid memory request |
| Previous Message | Michael Fuhr | 2005-09-04 02:34:06 | Re: UPDATE: pg_dump fails due to invalid memory request |