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

Re: How do I select the last Id in a column???

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Josh Goldberg <josh(at)4dmatrix(dot)com>
Cc: Michael Kovalcik <makd32(at)yahoo(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: How do I select the last Id in a column???
Date: 2003-06-26 23:30:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
On Thu, Jun 26, 2003 at 14:00:33 -0700,
  Josh Goldberg <josh(at)4dmatrix(dot)com> wrote:
> to get the last record inserted just
> select * from row order by autoincId desc limit 1;
> if you have several clients doing this you might want to put your insert and
> the select inside a transaction.

That won't help. Your suggestion will only work in serializable transactions.

In read committed mode the select might see a value for autoincId from
a transaction that committed between the insert and the select.

In response to


pgsql-admin by date

Next:From: Mendola GaetanoDate: 2003-06-27 00:18:52
Subject: Postgres RoadMap
Previous:From: Mendola GaetanoDate: 2003-06-26 22:56:22
Subject: 7.4 Documetation

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