Skip site navigation (1) Skip section navigation (2)

Re: Last Id?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:51:15
Message-ID: 14081.1125978675@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Jan Danielsson <jan(dot)danielsson(at)gmail(dot)com> writes:
>    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.

You evidently do not understand how currval works.  It is session-local,
so the race condition you are imagining does not exist.

			regards, tom lane

In response to

  • Last Id? at 2005-09-04 18:01:47 from Jan Danielsson

Responses

pgsql-novice by date

Next:From: Michael GlaesemannDate: 2005-09-06 03:56:00
Subject: Re: Last Id?
Previous:From: Tom LaneDate: 2005-09-06 01:05:50
Subject: Re: PGSQL and Nested Loops

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group