| From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
|---|---|
| To: | Jan Danielsson <jan(dot)danielsson(at)gmail(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: Last Id? |
| Date: | 2005-09-06 03:56:00 |
| Message-ID: | 86274769-A6A6-4D98-A304-2C1F967A9E6A@myrealbox.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Sep 5, 2005, at 3:01 AM, Jan Danielsson wrote:
> 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.
Welcome to PostgreSQL!
This is a very common misconception. Your fears are unfounded.
Read the FAQ or the documentation for details.
http://www.postgresql.org/docs/faqs.FAQ.html#4.11.1
http://www.postgresql.org/docs/8.0/interactive/functions-sequence.html
Hope this helps.
Michael Glaesemann
grzm myrealbox com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Fuhr | 2005-09-06 04:11:51 | Re: Last Id? |
| Previous Message | Tom Lane | 2005-09-06 03:51:15 | Re: Last Id? |