Re: last entry

From: "Ian Harding" <ianh(at)tpchd(dot)org>
To: <mixo(at)beth(dot)uniforum(dot)org(dot)za>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: last entry
Date: 2002-08-16 15:40:46
Message-ID: sd5cbb07.092@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you mean the value of the primary key (if a sequence is used) the way to do that is (in the same connection) to issue a "select currval('sequencename')" which will return the last used value of that sequence within the current connection.

If you mean the OID, there is a way to do that too, but I don't use them for ID so I don't know.

Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: iharding(at)tpchd(dot)org

We have only two things to worry about: That things will never get
back to normal, and that they already have.

>>> mixo <mixo(at)beth(dot)uniforum(dot)org(dot)za> 08/16/02 01:33AM >>>

Is it possible to identify the last entry that has been just insterted
into a table?

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Browse pgsql-general by date

  From Date Subject
Next Message stas-pgsql 2002-08-16 15:54:48 Re: Seq scan
Previous Message Oliver Elphick 2002-08-16 15:08:45 Re: Triggers