Hi jian, > The comments in preprocess_expression says we shouldn't > selectively skip constant folding for particular node fields
Agreed, and that convinces me my direction was wrong. I withdraw the suggestion of running the pass over the argument with evaluation turned off; nothing in eval_const_expressions() needs to change -- not a skip, not an evaluation-off pass, not the case itself. The reason I no longer think the case should just error is that v / 0 cannot fold on its own -- the parser requires a column reference of every navigation argument, so int4div keeps a Var -- and it becomes foldable only because pull_up_simple_values() has already replaced v with Const 10, in pullup_replace_vars_callback(). So the question looks like the substitution rather than the fold. Best regards, Henson
