This needs to be wary of the function volatility changing after we
check it. We cannot enforce this when checking at parse time, so move
it later, into the planner.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BrenyUte0_UJsJiDJQi82oaBsMJn%3Dcct0Wn%3DvOqXtuDn%3DYYJA%40mail.gmail.com
/* exclRelTlist contains only Vars, so no preprocessing needed */
}
+ if (parse->forPortionOf)
+ {
+ parse->forPortionOf->targetRange =
+ preprocess_expression(root,
+ parse->forPortionOf->targetRange,
+ EXPRKIND_TARGET);
+ if (contain_volatile_functions(parse->forPortionOf->targetRange))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("FOR PORTION OF bounds cannot contain volatile functions")));
+ }
+
foreach(l, parse->mergeActionList)
{
MergeAction *action = (MergeAction *) lfirst(l);
args,
InvalidOid, InvalidOid, COERCE_EXPLICIT_CALL);
}
- if (contain_volatile_functions_after_planning((Expr *) result->targetRange))
- ereport(ERROR,
- (errmsg("FOR PORTION OF bounds cannot contain volatile functions")));
/*
* Build overlapsExpr to use as an extra qual. This means we only hit rows