pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix assignment to array of domain over composite. 10+ messages / 1 participants [nested] [flat]
* pgsql: Fix assignment to array of domain over composite. @ 2021-10-19 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2021-10-19 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/3e310d837a9b3de8ad977c0a3e2a769bcdf61cc9 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(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite. @ 2021-10-19 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2021-10-19 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite. @ 2021-10-19 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2021-10-19 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/30e61a8cdc8624102ebdb1abbbb1e45457877c5c 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(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite. @ 2021-10-19 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2021-10-19 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ae7b1dd5900156c3d58d88bf47532adcb27cca26 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(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite. @ 2021-10-19 17:55 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2021-10-19 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0d08c279b0072fb0754ddc2b65eac0d61bade1d3 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(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite, redux. @ 2023-04-15 16:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2023-04-15 16:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assignment to array of domain over composite, redux. Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through CoerceToDomain nodes. That's not sufficient, because since commit 04fe805a1 it's been possible for the planner to simplify CoerceToDomain to RelabelType when the domain has no constraints to enforce. So we need to look through RelabelType too. Per bug #17897 from Alexander Lakhin. Although 3e310d837 was back-patched to v11, it seems sufficient to apply this change to v12 and later, since 04fe805a1 came in in v12. Dmitry Dolgov Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/064eb89e83ea0f59426c92906329f1e6c423dfa4 Modified Files -------------- src/backend/executor/execExpr.c | 10 ++++++++-- src/test/regress/expected/domain.out | 9 +++++++++ src/test/regress/sql/domain.sql | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite, redux. @ 2023-04-15 16:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2023-04-15 16:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assignment to array of domain over composite, redux. Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through CoerceToDomain nodes. That's not sufficient, because since commit 04fe805a1 it's been possible for the planner to simplify CoerceToDomain to RelabelType when the domain has no constraints to enforce. So we need to look through RelabelType too. Per bug #17897 from Alexander Lakhin. Although 3e310d837 was back-patched to v11, it seems sufficient to apply this change to v12 and later, since 04fe805a1 came in in v12. Dmitry Dolgov Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c53ed26ea46e425c1a78bd0e72b74a541eb08a93 Modified Files -------------- src/backend/executor/execExpr.c | 10 ++++++++-- src/test/regress/expected/domain.out | 9 +++++++++ src/test/regress/sql/domain.sql | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite, redux. @ 2023-04-15 16:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2023-04-15 16:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assignment to array of domain over composite, redux. Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through CoerceToDomain nodes. That's not sufficient, because since commit 04fe805a1 it's been possible for the planner to simplify CoerceToDomain to RelabelType when the domain has no constraints to enforce. So we need to look through RelabelType too. Per bug #17897 from Alexander Lakhin. Although 3e310d837 was back-patched to v11, it seems sufficient to apply this change to v12 and later, since 04fe805a1 came in in v12. Dmitry Dolgov Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9b104a27c72754e9a6a8043ad7e710c8c386a8db Modified Files -------------- src/backend/executor/execExpr.c | 10 ++++++++-- src/test/regress/expected/domain.out | 9 +++++++++ src/test/regress/sql/domain.sql | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite, redux. @ 2023-04-15 16:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2023-04-15 16:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assignment to array of domain over composite, redux. Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through CoerceToDomain nodes. That's not sufficient, because since commit 04fe805a1 it's been possible for the planner to simplify CoerceToDomain to RelabelType when the domain has no constraints to enforce. So we need to look through RelabelType too. Per bug #17897 from Alexander Lakhin. Although 3e310d837 was back-patched to v11, it seems sufficient to apply this change to v12 and later, since 04fe805a1 came in in v12. Dmitry Dolgov Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7428aecddf18edc25237eb41257ef023032ce4ad Modified Files -------------- src/backend/executor/execExpr.c | 10 ++++++++-- src/test/regress/expected/domain.out | 9 +++++++++ src/test/regress/sql/domain.sql | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Fix assignment to array of domain over composite, redux. @ 2023-04-15 16:01 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2023-04-15 16:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assignment to array of domain over composite, redux. Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through CoerceToDomain nodes. That's not sufficient, because since commit 04fe805a1 it's been possible for the planner to simplify CoerceToDomain to RelabelType when the domain has no constraints to enforce. So we need to look through RelabelType too. Per bug #17897 from Alexander Lakhin. Although 3e310d837 was back-patched to v11, it seems sufficient to apply this change to v12 and later, since 04fe805a1 came in in v12. Dmitry Dolgov Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/048caf8d757a94db043ddbc4d0b1131c1544fee1 Modified Files -------------- src/backend/executor/execExpr.c | 10 ++++++++-- src/test/regress/expected/domain.out | 9 +++++++++ src/test/regress/sql/domain.sql | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2023-04-15 16:01 UTC | newest] Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-10-19 17:55 pgsql: Fix assignment to array of domain over composite. Tom Lane <tgl@sss.pgh.pa.us> 2021-10-19 17:55 pgsql: Fix assignment to array of domain over composite. Tom Lane <tgl@sss.pgh.pa.us> 2021-10-19 17:55 pgsql: Fix assignment to array of domain over composite. Tom Lane <tgl@sss.pgh.pa.us> 2021-10-19 17:55 pgsql: Fix assignment to array of domain over composite. Tom Lane <tgl@sss.pgh.pa.us> 2021-10-19 17:55 pgsql: Fix assignment to array of domain over composite. Tom Lane <tgl@sss.pgh.pa.us> 2023-04-15 16:01 pgsql: Fix assignment to array of domain over composite, redux. Tom Lane <tgl@sss.pgh.pa.us> 2023-04-15 16:01 pgsql: Fix assignment to array of domain over composite, redux. Tom Lane <tgl@sss.pgh.pa.us> 2023-04-15 16:01 pgsql: Fix assignment to array of domain over composite, redux. Tom Lane <tgl@sss.pgh.pa.us> 2023-04-15 16:01 pgsql: Fix assignment to array of domain over composite, redux. Tom Lane <tgl@sss.pgh.pa.us> 2023-04-15 16:01 pgsql: Fix assignment to array of domain over composite, redux. Tom Lane <tgl@sss.pgh.pa.us>
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