Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: YasonTR <yasontr(at)protonmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10
Date: 2017-10-24 14:18:40
Message-ID: 22434.1508854720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

YasonTR <yasontr(at)protonmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message YasonTR 2017-10-24 14:55:10 Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10
Previous Message Pavel Suderevsky 2017-10-24 13:11:58 Re: BUG #14863: wrong reltuples statistics after vacuum without analyze