Re: INSERT/UPDATE ... RETURNING

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: INSERT/UPDATE ... RETURNING
Дата
Msg-id 18137.1051539505@sss.pgh.pa.us
обсуждение исходный текст
Ответ на INSERT/UPDATE ... RETURNING  (Gavin Sherry <swm@linuxworld.com.au>)
Список pgsql-hackers
Gavin Sherry <swm@linuxworld.com.au> writes:
> I am working on a project which requires INSERT/UPDATE ... RETURNING
> functionality.

This would be good to have.

> Oracle returns data into binded variables, which we do not support. It
> returns multiple rows into bind arrays, ie, an array of instances of 
> binded variables.

Right.  I think it would be better to return the result just like a
SELECT result.

> 2) Same row affected multiple times

> UPDATEs can affect rows multiple times.

No they can't.  Study the MVCC rules.

> 3) Inherited updates affecting multiple tables

> Seems that it would be the right thing to do to allow returning of
> inherited rows, but it might be a bit painful to implement. Ideas?

Why does this matter?  The RETURNING clause can only name columns of the
topmost table, and so these expressions can surely be computed for every
row of every child table too.

> 4) Handling rule cases

> Seems reasonable to allow RETURNING when the query is re-written to a
> single query and that the operation is not transformed.

In principle I think you could rewrite the RETURNING clause too, but
certainly it'd be okay to punt on this for a first implementation.
        regards, tom lane



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

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: INSERT/UPDATE ... RETURNING
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Please, apply patch for current CVS