Re: SQL-question: returning the id of an insert querry - Mailing list pgsql-general

From Tom Lane
Subject Re: SQL-question: returning the id of an insert querry
Date
Msg-id 29036.1068676711@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL-question: returning the id of an insert querry  (Doug McNaught <doug@mcnaught.org>)
List pgsql-general
Doug McNaught <doug@mcnaught.org> writes:
> Scott Chapman <scott_list@mischko.com> writes:
>> What's the process to suggest changes to PG along these lines?  Say, a
>> proposal to make it configurable for a user to have a INSERT return the
>> primary key that it just inserted rather than what it returns now?

> What if you have a multicolumn PK?

Or a PK that's not an integer?  Or no PK at all?

There's not likely to be any interest in hotwiring INSERT to return
a different command tag than it does now; that would break too much
existing code.  There has been some talk of inventing an "INSERT
... RETURNING ..." syntax extension that would return whatever
expressions you cared to compute from inserted rows --- but in the form
of a SELECT result, not by trying to squeeze it into a command tag.
I think the last discussion of this was a year or so back in pg-hackers.

            regards, tom lane

pgsql-general by date:

Previous
From: Christopher Murtagh
Date:
Subject: Re: plpgsql return setof integer?
Next
From: Alex
Date:
Subject: PL/PGSQL functions suddenly not working