Re: Support UPDATE table SET(*)=...

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Support UPDATE table SET(*)=...
Дата
Msg-id 20150407190044.GL4369@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Support UPDATE table SET(*)=...  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Support UPDATE table SET(*)=...  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Tom Lane wrote:

> I spent a fair amount of time cleaning this patch up to get it into
> committable shape, but as I was working on the documentation I started
> to lose enthusiasm for it, because I was having a hard time coming up
> with compelling examples.  The originally proposed motivation was
> 
> >> It solves the problem of doing UPDATE from a record variable of the same
> >> type as the table e.g. update foo set (*) = (select foorec.*) where ...;
> 
> but it feels to me that this is not actually a very good solution to that
> problem --- even granting that the problem needs to be solved, a claim
> that still requires some justification IMO.

How about an UPDATE ran inside a plpgsql function, which is using a row
variable of the table type?  You could assign values to individual
columns of q row variable, and run the multicolumn UPDATE last.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Support UPDATE table SET(*)=...
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Support UPDATE table SET(*)=...