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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: 110876189(at)qq(dot)com
Subject: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
Date: 2018-06-12 02:00:57
Message-ID: 152876885706.32361.1270737678956483321@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 15237
Logged by: zhou xiaowei
Email address: 110876189(at)qq(dot)com
PostgreSQL version: 11beta1
Operating system: centos
Description:

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"".
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.
Detail:
postgres=# \d fvt_obj_operate_update_table_033
Table "public.fvt_obj_operate_update_table_033"
Column | Type | Collation | Nullable |
Default
--------------+-----------------------------+-----------+----------+---------
c_char | character(102400) | | |
c_varchar | character varying(1024) | | |
c_int | integer | | |
c_dp | double precision | | |
c_ts_without | timestamp without time zone | | |
Indexes:
"fvt_obj_operate_update_index_033" UNIQUE, btree (c_int)

postgres=# update fvt_obj_operate_update_table_033 set (c_int) = (20) where
c_int = 20;
2018-06-12 09:46:39.877 CST [94901] ERROR: source for a multiple-column
UPDATE item must be a sub-SELECT or ROW() expression at character 56
2018-06-12 09:46:39.877 CST [94901] STATEMENT: update
fvt_obj_operate_update_table_033 set (c_int) = (20) where c_int = 20;
ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or
ROW() expression
LINE 1: ...e fvt_obj_operate_update_table_033 set (c_int) = (20) where ...
^
postgres=# update fvt_obj_operate_update_table_033 set (c_int,c_dp) =
(20,1.11) where c_int = 20;
UPDATE 1
postgres=#

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.
Please help,thanks!

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-06-12 03:38:23 Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"
Previous Message K S, Sandhya (Nokia - IN/Bangalore) 2018-06-11 05:44:13 RE: psql crashes found when executing slash commands

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2018-06-12 03:04:52 Does logical replication supports cross platform servers?
Previous Message David Rowley 2018-06-12 01:37:42 Re: Needless additional partition check in INSERT?