Re: SQL-question: returning the id of an insert querry

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQL-question: returning the id of an insert querry
Дата
Msg-id 29036.1068676711@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SQL-question: returning the id of an insert querry  (Doug McNaught <doug@mcnaught.org>)
Список 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 по дате отправления:

Предыдущее
От: Christopher Murtagh
Дата:
Сообщение: Re: plpgsql return setof integer?
Следующее
От: Alex
Дата:
Сообщение: PL/PGSQL functions suddenly not working