aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execExpr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-04-15 12:01:39 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-04-15 12:01:39 -0400
commitc53ed26ea46e425c1a78bd0e72b74a541eb08a93 (patch)
treeacefc1096132b93981c9a81a1fe70731c4486dcb /src/backend/executor/execExpr.c
parentde575c78e14c909ce6962021552e0263ac237935 (diff)
downloadpostgresql-c53ed26ea46e425c1a78bd0e72b74a541eb08a93.tar.gz
postgresql-c53ed26ea46e425c1a78bd0e72b74a541eb08a93.zip
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
Diffstat (limited to 'src/backend/executor/execExpr.c')
-rw-r--r--src/backend/executor/execExpr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index d89445ee7ba..26d7972f837 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3131,8 +3131,8 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref,
* trees in which each level of assignment has its own CaseTestExpr, and the
* recursive structure appears within the newvals or refassgnexpr field.
* There is an exception, though: if the array is an array-of-domain, we will
- * have a CoerceToDomain as the refassgnexpr, and we need to be able to look
- * through that.
+ * have a CoerceToDomain or RelabelType as the refassgnexpr, and we need to
+ * be able to look through that.
*/
static bool
isAssignmentIndirectionExpr(Expr *expr)
@@ -3159,6 +3159,12 @@ isAssignmentIndirectionExpr(Expr *expr)
return isAssignmentIndirectionExpr(cd->arg);
}
+ else if (IsA(expr, RelabelType))
+ {
+ RelabelType *r = (RelabelType *) expr;
+
+ return isAssignmentIndirectionExpr(r->arg);
+ }
return false;
}