From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: YasonTR <yasontr@protonmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10
Date: Tue, 24 Oct 2017 11:21:26 -0400
Message-ID: <25202.1508858486@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYLcxGUtBJEEuUUo=NZ-KDNyuB_DacaPV=0csXjoBLbXA@mail.gmail.com>
References: <DzifLcHs-9wlp5kq6MPKTxu6zI8s5LhAEaVsrq_NRTuQTkw_EWrogrLgDhQ7i5W-cvaIPig0gH59FzBk7Lwr8FUvV7H0fLOYI8heueaoG1Y=@protonmail.com>
<22434.1508854720@sss.pgh.pa.us>
<gJQHKF6S1zCGkc_hq8S0neCD7N6R4frak1GgPvx8ETdKd4pWH3AgGarDw1Ic6hU1XgBoVeQ4WKOfnv7elm-rN3G1jwhOqyxI8IeounEc6v0=@protonmail.com>
<CAKFQuwYLcxGUtBJEEuUUo=NZ-KDNyuB_DacaPV=0csXjoBLbXA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Oct 24, 2017 at 7:55 AM, YasonTR <yasontr@protonmail.com> wrote:
>> 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).
> "The key word ROW is optional when there is more than one expression in
> the list."
Right. This was not one of the SQL committee's better syntax choices,
in my book --- allowing ROW to be optional makes the single-column case
a weird exception, since then and only then ROW is required to make it a
row constructor and not just an expression with useless extra parens.
The spec says that the source value for a parenthesized SET list
is a <contextually typed row value expression>. Pre-v10, we handled
this with a grammar hack that looked specifically for a parenthesized
list of expressions, and as it happened it would accept a single
parenthesized expression as well. Now it's expecting a normal
row constructor, which can be one of
ROW(one_expr)
ROW(an_expr, another_expr [, ...])
(an_expr, another_expr [, ...])
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, yasontr@protonmail.com
Subject: Re: Possible regression in 'UPDATE ... SET (<column list>) = <row expression>' with just one single column/row value since v10
In-Reply-To: <25202.1508858486@sss.pgh.pa.us>
References: <DzifLcHs-9wlp5kq6MPKTxu6zI8s5LhAEaVsrq_NRTuQTkw_EWrogrLgDhQ7i5W-cvaIPig0gH59FzBk7Lwr8FUvV7H0fLOYI8heueaoG1Y=@protonmail.com> <22434.1508854720@sss.pgh.pa.us> <gJQHKF6S1zCGkc_hq8S0neCD7N6R4frak1GgPvx8ETdKd4pWH3AgGarDw1Ic6hU1XgBoVeQ4WKOfnv7elm-rN3G1jwhOqyxI8IeounEc6v0=@protonmail.com> <CAKFQuwYLcxGUtBJEEuUUo=NZ-KDNyuB_DacaPV=0csXjoBLbXA@mail.gmail.com> <25202.1508858486@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox