Re: request for sql3 compliance for the update command

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: request for sql3 compliance for the update command
Дата
Msg-id 17070.1045714776@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: request for sql3 compliance for the update command  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> While I don't see the syntax of:
>     update table set (col...) = ( val...)
> as valuable compared to separate col=val assignments, I do see a value
> in allowing subqueries in such assignments:
>     update table set (col...) = ( select val ..)

Hm.  That's at least got some defensibility to it.  But does it do
anything that you can't already do with a join?

BTW, looking at the SQL99 standard, I see that you can do
UPDATE table SET ROW = foo WHERE ...

where foo is supposed to yield a row of the same rowtype as table
--- I didn't dig through the spec in detail, but I imagine foo can
be a sub-select.  I don't care a whole lot for that, though, since it
would be a real pain in the neck if you're not updating all the columns.
You'd have to go
UPDATE table SET ROW = (SELECT table.a, table.b, foo.x, ... FROM foo)

which seems ugly, tedious, and error-prone.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: request for sql3 compliance for the update command
Следующее
От: Gavin Sherry
Дата:
Сообщение: Re: request for sql3 compliance for the update command