Re: [NOVICE] Last ID Problem - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: [NOVICE] Last ID Problem
Date
Msg-id 42013BCE.2000604@opencloud.com
Whole thread Raw
In response to Re: [NOVICE] Last ID Problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Greg Stark <gsstark@mit.edu> writes:
> 
>>Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: [NOVICE] Last ID Problem
Next
From: Tom Lane
Date:
Subject: Re: [NOVICE] Last ID Problem