Fix assignment to array of domain over composite.
authorTom Lane <[email protected]>
Tue, 19 Oct 2021 17:54:45 +0000 (13:54 -0400)
committerTom Lane <[email protected]>
Tue, 19 Oct 2021 17:54:45 +0000 (13:54 -0400)
commit3e310d837a9b3de8ad977c0a3e2a769bcdf61cc9
treef32edbada2c1da02ae1c78c32b6de1f9d918267b
parent697dd1925f418c9f54ee1fd1cefbc613d6504b1f
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
src/backend/executor/execExpr.c
src/test/regress/expected/domain.out
src/test/regress/sql/domain.sql