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

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

From
Mahendra Singh Thalor
Date:
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@sss.pgh.pa.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
On Mon, Mar 22, 2021 at 02:10:49PM +0530, Mahendra Singh Thalor wrote:
> 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.

See prior discussions:

https://www.postgresql.org/message-id/flat/20170719174507.GA19616%40telsasoft.com
https://www.postgresql.org/message-id/flat/CAMjNa7cDLzPcs0xnRpkvqmJ6Vb6G3EH8CYGp9ZBjXdpFfTz6dg@mail.gmail.com
https://www.postgresql.org/message-id/flat/87sh5rs74y.fsf@news-spur.riddles.org.uk
https://git.postgresql.org/gitweb/?p=postgresql.git&a=commit&h=86182b18957b8f9e8045d55b137aeef7c9af9916

-- 
Justin



On Tue, 23 Mar 2021 at 02:43, Justin Pryzby <pryzby@telsasoft.com> wrote:
>
> On Mon, Mar 22, 2021 at 02:10:49PM +0530, Mahendra Singh Thalor wrote:
> > 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.
>
> See prior discussions:
>
> https://www.postgresql.org/message-id/flat/20170719174507.GA19616%40telsasoft.com
> https://www.postgresql.org/message-id/flat/CAMjNa7cDLzPcs0xnRpkvqmJ6Vb6G3EH8CYGp9ZBjXdpFfTz6dg@mail.gmail.com
> https://www.postgresql.org/message-id/flat/87sh5rs74y.fsf@news-spur.riddles.org.uk
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commit&h=86182b18957b8f9e8045d55b137aeef7c9af9916
>

Thanks Justin.

Sorry, my mistake is that without checking prior discussion, i opened
a new thread. From next time, I will take care of this.

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