Commit 1571bc0f authored by Tom Lane's avatar Tom Lane

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 c12d570f, so back-patch to v11.

Discussion: https://postgr.es/m/27571.1550617881@sss.pgh.pa.us
parent 5721b9b3
...@@ -1179,9 +1179,8 @@ contain_nonstrict_functions_walker(Node *node, void *context) ...@@ -1179,9 +1179,8 @@ contain_nonstrict_functions_walker(Node *node, void *context)
* the per-element expression is; so we should ignore elemexpr and * the per-element expression is; so we should ignore elemexpr and
* recurse only into the arg. * recurse only into the arg.
*/ */
return expression_tree_walker((Node *) ((ArrayCoerceExpr *) node)->arg, return contain_nonstrict_functions_walker((Node *) ((ArrayCoerceExpr *) node)->arg,
contain_nonstrict_functions_walker, context);
context);
} }
if (IsA(node, CaseExpr)) if (IsA(node, CaseExpr))
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment