Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates can produce errors - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates can produce errors
Date
Msg-id 30606.1509489839@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates can produce errors  (Rob McColl <rob@robmccoll.com>)
Responses Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates canproduce errors  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
Rob McColl <rob@robmccoll.com> writes:
> Attaching patch... :-/

The reason why hacking your way to a backwards-compatible solution is
a bad idea is that it breaks the SQL standard compliance we're trying to
achieve here.  According to the spec, the elements of a parenthesized
SET list should be assigned from the fields of a composite RHS.  If
there's just one element of the SET list, the RHS should be a single-field
composite value, and this syntax should result in extracting its field.
This patch doesn't do that; it preserves our previous broken behavior,
and thus just puts off the day of reckoning that inevitably will come.

As a concrete example, the spec says this should work:

create table t (f1 int);
update t set (f1) = row(4);

and it does in v10, but (without having tested) your patch will break it.
This is not so exciting for simple row constructors, where you could just
leave off the word ROW; but it is a critical distinction if we're ever to
get to the point of allowing other composite-returning constructs here,
for example composite-returning functions.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Gilles Darold
Date:
Subject: Re: [HACKERS] proposal: schema variables
Next
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] Re: PANIC: invalid index offnum: 186 when processingBRIN indexes in VACUUM