Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
Дата
Msg-id 22079.1528774703@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #15237: I got "ERROR: source for a multiple-column UPDATE itemmust be a sub-SELECT or ROW() expression"  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-bugs
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> On PostgreSQL 11 Beta, I exec sql like "update
> fvt_obj_operate_update_table_033 set (c_int) = (20) where c_int = 20;",
> which only on column to set, got ""ERROR:  source for a multiple-column
> UPDATE item must be a sub-SELECT or ROW() expression"".

It's telling you what to do: use a ROW() expression, ie

update fvt_obj_operate_update_table_033 set (c_int) = row(20)
  where c_int = 20;

> But I exec sql like "update fvt_obj_operate_update_table_033 set
> (c_int,c_dp) = (20,1.11) where c_int = 20;", got successfull message.

(20) and row(20) are not the same thing, whereas (20,1.11) and
row(20,1.11) are the same thing.  Don't blame us, it was the SQL
committee's idea that "ROW" should be optional for the latter.

> The cause of this error is because syntax rule conflict between "'(' a_expr
> ')' opt_indirection" and "implicit_row:    '(' expr_list ',' a_expr ')'".I
> think "'(' a_expr ')'" is also a subset of row.
> I want to modify it, but didn‘t got a good idea.

Don't even think about it.  It's unfixable without creating even worse
problems, like causing an extra pair of parentheses to change the meaning
of an expression.

            regards, tom lane


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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15237: I got "ERROR: source for a multiple-column UPDATE itemmust be a sub-SELECT or ROW() expression"
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"