|
|
@ -2497,6 +2497,36 @@ eval_const_expressions_mutator(Node *node, |
|
|
|
newexpr->location = expr->location; |
|
|
|
newexpr->location = expr->location; |
|
|
|
return (Node *) newexpr; |
|
|
|
return (Node *) newexpr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case T_NullIfExpr: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
NullIfExpr *expr; |
|
|
|
|
|
|
|
ListCell *arg; |
|
|
|
|
|
|
|
bool has_nonconst_input = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Copy the node and const-simplify its arguments */ |
|
|
|
|
|
|
|
expr = (NullIfExpr *) ece_generic_processing(node); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If either argument is NULL they can't be equal */ |
|
|
|
|
|
|
|
foreach(arg, expr->args) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!IsA(lfirst(arg), Const)) |
|
|
|
|
|
|
|
has_nonconst_input = true; |
|
|
|
|
|
|
|
else if (((Const *) lfirst(arg))->constisnull) |
|
|
|
|
|
|
|
return (Node *) linitial(expr->args); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Need to get OID of underlying function before checking if |
|
|
|
|
|
|
|
* the function is OK to evaluate. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
set_opfuncid((OpExpr *) expr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!has_nonconst_input && |
|
|
|
|
|
|
|
ece_function_is_safe(expr->opfuncid, context)) |
|
|
|
|
|
|
|
return ece_evaluate_expr(expr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (Node *) expr; |
|
|
|
|
|
|
|
} |
|
|
|
case T_ScalarArrayOpExpr: |
|
|
|
case T_ScalarArrayOpExpr: |
|
|
|
{ |
|
|
|
{ |
|
|
|
ScalarArrayOpExpr *saop; |
|
|
|
ScalarArrayOpExpr *saop; |
|
|
|