aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-02-20 13:36:55 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-02-20 13:36:55 -0500
commit93ec0c90cde7e0188c96bca9a8ba815b58c00d24 (patch)
tree22d7282d5e467c08d9de273d2132e7664391ee70
parent728ac262d18e17342c28183846c1405768f93d13 (diff)
downloadpostgresql-93ec0c90cde7e0188c96bca9a8ba815b58c00d24.tar.gz
postgresql-93ec0c90cde7e0188c96bca9a8ba815b58c00d24.zip
Fix incorrect strictness test for ArrayCoerceExpr expressions.
The recursion in contain_nonstrict_functions_walker() was done wrong, causing the strictness check to be bypassed for a parse node that is the immediate input of an ArrayCoerceExpr node. This could allow, for example, incorrect decisions about whether a strict SQL function can be inlined. I didn't add a regression test, because (a) the bug is so narrow and (b) I couldn't think of a test case that wasn't dependent on a large number of other behaviors, to the point where it would likely soon rot to the point of not testing what it was intended to. I broke this in commit c12d570fa, so back-patch to v11. Discussion: https://postgr.es/m/27571.1550617881@sss.pgh.pa.us
-rw-r--r--src/backend/optimizer/util/clauses.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index df56569c502..1daafe1ea72 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -1409,9 +1409,8 @@ contain_nonstrict_functions_walker(Node *node, void *context)
* the per-element expression is; so we should ignore elemexpr and
* recurse only into the arg.
*/
- return expression_tree_walker((Node *) ((ArrayCoerceExpr *) node)->arg,
- contain_nonstrict_functions_walker,
- context);
+ return contain_nonstrict_functions_walker((Node *) ((ArrayCoerceExpr *) node)->arg,
+ context);
}
if (IsA(node, CaseExpr))
return true;