pgsql: Fix assignment to array of domain over composite.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assignment to array of domain over composite.
Date: 2021-10-19 17:55:02
Message-ID: E1mctKI-0002c2-Jk@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assignment to array of domain over composite.

An update such as "UPDATE ... SET fld[n].subfld = whatever"
failed if the array elements were domains rather than plain
composites. That's because isAssignmentIndirectionExpr()
failed to cope with the CoerceToDomain node that would appear
in the expression tree in this case. The result would typically
be a crash, and even if we accidentally didn't crash, we'd not
correctly preserve other fields of the same array element.

Per report from Onder Kalaci. Back-patch to v11 where arrays of
domains came in.

Discussion: https://postgr.es/m/PH0PR21MB132823A46AA36F0685B7A29AD8BD9@PH0PR21MB1328.namprd21.prod.outlook.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/04dae19f4d5067b35b421dcd43175a5059747800

Modified Files
--------------
src/backend/executor/execExpr.c | 19 ++++++++++++++-----
src/test/regress/expected/domain.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/domain.sql | 17 +++++++++++++++++
3 files changed, 55 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-10-19 18:17:34 pgsql: Refactor the sslfiles Makefile target for ease of use
Previous Message Tom Lane 2021-10-19 15:35:44 pgsql: Remove bogus assertion in transformExpressionList().