Re: [BUGS] Possible regression in 'UPDATE ... SET () = ' with just one single column/row value since v10 - Mailing list pgsql-bugs

From YasonTR
Subject Re: [BUGS] Possible regression in 'UPDATE ... SET () = ' with just one single column/row value since v10
Date
Msg-id gJQHKF6S1zCGkc_hq8S0neCD7N6R4frak1GgPvx8ETdKd4pWH3AgGarDw1Ic6hU1XgBoVeQ4WKOfnv7elm-rN3G1jwhOqyxI8IeounEc6v0=@protonmail.com
Whole thread Raw
In response to Re: [BUGS] Possible regression in 'UPDATE ... SET () = ' with just one single column/row value since v10  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] Possible regression in 'UPDATE ... SET () =' with just one single column/row value since v10  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
Hi Tom,

I get your reference to the spec, but why is it working without ROW() when multiple columns are involved? For example: "UPDATE my_table SET (a, b) = (x, y)" works on v10 (afaik).

Thank you.



-------- Original Message --------
Subject: Re: [BUGS] Possible regression in 'UPDATE ... SET () = ' with just one single column/row value since v10
Local Time: October 24, 2017 4:18 PM
UTC Time: October 24, 2017 2:18 PM
From: tgl@sss.pgh.pa.us
To: YasonTR <yasontr@protonmail.com>
pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>

YasonTR yasontr@protonmail.com writes:
The following (odd) construction worked in pgv9.x: "UPDATE my_table SET (my_col) = (some value)". This no longer works in v10. It gives the error "source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression". It looks like it only breaks when the column list just holds one single column.

Yeah, IIRC this was an intentional change. The fact that the previous
coding allowed you to do that was a mistake, because per spec you really
need to supply a row value when you parenthesize the SET column list.
As of v10 it should work to write
UPDATE my_table SET (my_col) = ROW(some value)

regards, tom lane


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] Possible regression in 'UPDATE ... SET () = ' with just one single column/row value since v10
Next
From: "David G. Johnston"
Date:
Subject: Re: [BUGS] Possible regression in 'UPDATE ... SET () =' with just one single column/row value since v10