From: Tom Lane <tgl@sss.pgh.pa.us>
To: 110876189@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
Date: Mon, 11 Jun 2018 23:38:23 -0400
Message-ID: <22079.1528774703@sss.pgh.pa.us> (raw)
In-Reply-To: <152876885706.32361.1270737678956483321@wrigleys.postgresql.org>
References: <152876885706.32361.1270737678956483321@wrigleys.postgresql.org>
=?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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, 110876189@qq.com
Subject: Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
In-Reply-To: <22079.1528774703@sss.pgh.pa.us>
References: <152876885706.32361.1270737678956483321@wrigleys.postgresql.org> <22079.1528774703@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox