Re: UPDATE...RETURNING col INTO var - what is returned?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: UPDATE...RETURNING col INTO var - what is returned?
Дата
Msg-id 70562DA9-3A77-4264-8168-365C8650141F@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на UPDATE...RETURNING col INTO var - what is returned?  (Rainer Pruy <Rainer.Pruy@Acrys.COM>)
Ответы Re: UPDATE...RETURNING col INTO var - what is returned?  (Rainer Pruy <Rainer.Pruy@Acrys.COM>)
Список pgsql-general
On 27 May 2010, at 18:12, Rainer Pruy wrote:

> Hi all,
> I just got quite confused on the exact semantics
> of "RETURNING expressions INTO target" with an update statement.
>
> And while trying to resolve failed to find an answer in the  docs.
>
> Question was whether - in case "expression" is involving a column that is assigned by the update itself -
> the value returned is based on the "old" value or the "new" value".
>
> While I'm no back to assuming is has to be the "old" one,
> I did not find a reference to that fact with the docs.

I'm pretty sure it's the new value, since that's what INSERT...RETURNING returns - very convenient if the value you
insertedwas generated somehow (by a sequence for example). 
Since you can also UPDATE some column using a generated value, it'd make sense if it would behave the same way.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4bfea81210411699814628!



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

Предыдущее
От: Rainer Pruy
Дата:
Сообщение: UPDATE...RETURNING col INTO var - what is returned?
Следующее
От: "Davor J."
Дата:
Сообщение: conditional rules VS 1 unconditional rule with multiple commands?