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

From Tom Lane
Subject Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
Date
Msg-id 22079.1528774703@sss.pgh.pa.us
Whole thread Raw
In response to 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>)
Responses 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>)
List 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 by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15237: I got "ERROR: source for a multiple-column UPDATE itemmust be a sub-SELECT or ROW() expression"
Next
From: Andrew Gierth
Date:
Subject: Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"