Osvaldo Kussama wrote:
2009/10/4 mohammad qoreishy <m_qorei...@yahoo.com>
How can get last inserted record in a table without any autoincrement filed?
I need to  frequently fetch the last inserted record.
If I must use the "Cursor" please explain your solution.



RETURNING clause?
http://www.postgresql.org/docs/current/interactive/sql-insert.html

Osvaldo

It took the OP to mean last insert as in randomly in the past, not as part of current transaction. My fear is OP's schema has no way of identifying time-of-insert, nor a monotonically increasing record id and is hoping postgres has a some internal value that will return the most recently inserted record. Without a table definition it's hard to say.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to