Thread: last entry

last entry

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



Re: last entry

From
"Ian Harding"
Date:
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
issuea "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@tpchd.org

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


>>> mixo <mixo@beth.uniforum.org.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


Re: last entry

From
"omid omoomi"
Date:
select * from yourtable order by oid desc limit 1;


>From: mixo <mixo@beth.uniforum.org.za>
>To: pgsql-general@postgresql.org
>Subject: [GENERAL] last entry
>Date: Fri, 16 Aug 2002 10:33:03 +0200
>
>
>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




_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com