Re: Incomplete idea about views and INSERT...RETURNING

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Incomplete idea about views and INSERT...RETURNING
Дата
Msg-id 8848.995842215@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Incomplete idea about views and INSERT...RETURNING  (Andrew McMillan <andrew@catalyst.net.nz>)
Список pgsql-hackers
Andrew McMillan <andrew@catalyst.net.nz> writes:
> Tom Lane wrote:
>> Could we get away with restricting INSERT RETURNING to work only on
>> inserts directly to tables (no ON INSERT DO INSTEAD allowed)?  Or is
>> that too much of a kluge?

> Isn't it likely that the person writing the RULE would want to
> internally use an INSERT ... RETURNING query and that the RETURNS
> ... should either use values from that, or use a SELECT clause keyed
> on values from that?

Hmm, so we'd allow INSERT RETURNING to be the last statement of an
ON INSERT DO INSTEAD rule, and the RETURNING clause would either be
dropped (if rewriting a plain INSERT) or used to form the outputs
(if rewriting INSERT RETURNING).  Kind of limited maybe, but it would
work for simple cases, which is a lot better than none at all...

The trouble with INSERT RETURNING followed by SELECT is that a rule
has noplace to keep the results: it hasn't got any local variables.
(And I don't think I want to invent such a feature, at least not on
the spur of the moment.)
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: mlw
Дата:
Сообщение: Re: sub queries and caching.
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: RE: More ADD CONSTRAINT behaviour questions