UPDATE ... SET (single_column) = row_constructor is a bit broken from V10 906bfcad7ba7c

From: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: UPDATE ... SET (single_column) = row_constructor is a bit broken from V10 906bfcad7ba7c
Date: 2021-03-22 08:40:49
Message-ID: CAKYtNAoF0=kY5F00z7ru1vKgiL-SgbKmyewmPHJchsNeKArWCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Commit 906bfcad7ba7c has improved handling for "UPDATE ... SET
(column_list) = row_constructor", but it has broken in some cases where it
was working prior to this commit.
After this commit query “DO UPDATE SET (t1_col)” is giving an error which
was working fine earlier.

commit 906bfcad7ba7cb3863fe0e2a7810be8e3cd84fbd
> Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Date: Tue Nov 22 15:19:57 2016 -0500
>
> Improve handling of "UPDATE ... SET (column_list) = row_constructor".
>
> Previously, the right-hand side of a multiple-column assignment, if it
>

*Test case:*
CREATE TABLE t1 (id1 int NOT NULL primary key, t1_col text NOT NULL);
INSERT INTO t1(id1, t1_col) VALUES (88,'test1') ON CONFLICT ( id1 )
DO UPDATE SET (t1_col) = ('test2');
ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or
ROW() expression
LINE 1: ...') ON CONFLICT ( id1 )DO UPDATE SET (t1_col) = ('test2');
^
I am getting above error from v10 to master but it is passing in v96 and
v95.

If we change "SET (t1_col)" to "SET t1_col", then the above test case is
passing in all the branches.

This looks like a bug.

Thoughts?

Thanks and Regards
Mahendra Singh Thalor
EnterpriseDB: http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-03-22 08:49:26 Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Previous Message Peter Eisentraut 2021-03-22 08:38:15 Re: [PATCH] Identify LWLocks in tracepoints