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

Re: [NOVICE] Last ID Problem

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [NOVICE] Last ID Problem
Date: 2005-02-02 20:45:02
Message-ID: 42013BCE.2000604@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane wrote:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
> 
>>Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>
>>>How is what you're suggesting more portable?
> 
> 
>>Well, the driver would be free to implement $sth->last_insert_id() using
>>whatever proprietary extensions it has available. The non-portableness would
>>at least be hidden in the driver layer.
> 
> 
> Are you asserting that last_insert_id() is a portable function?  I doubt
> it.

I'm not familiar with the Perl interface, but JDBC has a standardized 
interface for this:

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#executeUpdate(java.lang.String,%20int)
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#getGeneratedKeys()

I tend to agree that a protocol-level change is easier to support in a 
driver. If it's done by extending INSERT/UPDATE, the driver will need to 
parse and modify queries which is hairy at the best of times.

-O

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-02-02 21:04:27
Subject: Re: [NOVICE] Last ID Problem
Previous:From: Martin PittDate: 2005-02-02 20:42:28
Subject: Re: libpq API incompatibility between 7.4 and 8.0

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