On Sat, Aug 02, 2003 at 12:22:28AM -0500, [EMAIL PROTECTED] wrote:
In short, I think the answer to the original question is that there is no
reliable way to find out what the last record inserted was.
It returns the last record *you* entered. If you want the last record
entered by
On Fri, 2003-08-01 at 18:25, b b wrote:
Is there an environment variable that returns the
primary key of the last inserted row. This is usefull
if you insert a rwo and need the primary key to insert
it into another table as a foreign key.
In MS-SQL that is equivalent to @@identity
On Fri, Aug 01, 2003 at 04:25:05PM -0700, b b wrote:
Is there an environment variable that returns the
primary key of the last inserted row. This is usefull
if you insert a rwo and need the primary key to insert
it into another table as a foreign key.
In MS-SQL that is equivalent to
On Fri, 2003-08-01 at 22:27, Martijn van Oosterhout wrote:
On Fri, Aug 01, 2003 at 04:25:05PM -0700, b b wrote:
Is there an environment variable that returns the
primary key of the last inserted row. This is usefull
if you insert a rwo and need the primary key to insert
it into
On Fri, Aug 01, 2003 at 10:43:03PM -0500, Ron Johnson wrote:
On Fri, 2003-08-01 at 22:27, Martijn van Oosterhout wrote:
On Fri, Aug 01, 2003 at 04:25:05PM -0700, b b wrote:
Is there an environment variable that returns the
primary key of the last inserted row. This is usefull
if
See currval() and nextval().
What if his PK isn't a sequence?
Moreover, currval() and nextval() won't guarantee that you always get the
most recently inserted sequence value, either, because each connection
can have a cache of sequence values to assign from. While the backend
guarantees
On Fri, Aug 01, 2003 at 11:18:30PM -0500, [EMAIL PROTECTED] wrote:
See currval() and nextval().
What if his PK isn't a sequence?
Moreover, currval() and nextval() won't guarantee that you always get the
most recently inserted sequence value, either, because each connection
can have
In short, I think the answer to the original question is that there is no
reliable way to find out what the last record inserted was.
It returns the last record *you* entered. If you want the last record
entered by anyone (committed ofcourse), you'd use order by x desc limit 1.
I agree