Re: "RETURNING PRIMARY KEY" syntax extension

From: Jim Nasby <jim(at)nasby(dot)net>
To: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>, Ian Barwick <ian(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "RETURNING PRIMARY KEY" syntax extension
Date: 2014-06-09 20:23:51
Message-ID: 539617D7.1020300@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/9/14, 8:35 AM, Hannu Krosing wrote:
> On 06/09/2014 06:58 AM, Ian Barwick wrote:
>> Hi,
>>
>> The JDBC API provides the getGeneratedKeys() method as a way of
>> retrieving
>> primary key values without the need to explicitly specify the primary key
>> column(s).
> Is it defined by the standard, to return _only_ generated primary keys,
> and not
> for example generated alternate keys ?

I was wondering that myself. I think it's certainly reasonable to expect someone would wan RETURNING SEQUENCE VALUES, which would return the value of every column that owned a sequence (ie: ALTER SEQUENCE ... OWNED BY). ISTM that would certainly handle the performance aspect of this, and it sounds more in line with what I'd expect getGeneratedKeys() to do.
--
Jim C. Nasby, Data Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-06-09 21:15:24 Re: BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby
Previous Message Alvaro Herrera 2014-06-09 19:49:59 Re: BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby