Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates canproduce errors
От
David G. Johnston
Тема
Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates canproduce errors
Дата
Msg-id
CAKFQuwZcht7u6eV6CUFFw3unGphasTL5-Wce5NwPnekhw-vDtg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates can produce errors Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates canproduce errors "David G. Johnston" <david.g.johnston@gmail.com>
Re: [HACKERS] PostgreSQL 10 parenthesized single-column updates can produce errors Tom Lane <tgl@sss.pgh.pa.us>
I believe that this is not an intended change or behavior, but is instead an unintentional side effect of 906bfcad7ba7cb3863fe0e2a7810be8e3cd84fbd Improve handling of "UPDATE ... SET (column_list) = row_constructor". (https://github.com/postgres/p ostgres/commit/906bfcad7ba7cb3 863fe0e2a7810be8e3cd84fbd).
At this point the intent of 906bfcad doesn't really matter - and given the number of complaints in the month since v10 went live I'm tending to lean toward bringing the pre-10 behavior back. There is no ambiguity involved here and the breakage of existing applications seems considerably worse than the technical oddity of allowing (val) to be interpreted as a row_constructor in this situation. From a standards perspective we are strictly more permissive so no new problem there.
On a related note, the 10.0 syntax guide is wrong, it needs to break out the parenthesized single-column and multi-column variants separately:
Presently: ( column_name [, ...] ) = [ ROW ] ( { expression | DEFAULT } [, ...] )
Basically one cannot specify only a single column_name AND omit ROW
It would have been nice if the syntax for that variant would have been:
( column_name, column_name [, ...] ) = [ ROW ] ( { expression | DEFAULT }, { expression | DEFAULT } [, ...] )
If the v10 behavior remains the above change should be made as well as adding:
( column_name ) = ROW ( expression | DEFAULT )
If we revert 10 to the pre-10 behavior the existing syntax will work.
David J.
В списке pgsql-hackers по дате отправления
От: Tomas Vondra
Дата:
От: David G. Johnston
Дата: