Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> writes: > I wonder if it would be better to add the CacheExpr nodes to the tree as > a separate pass, instead of shoehorning it into eval_const_expressions? > I think would be more readable that way, even though a separate pass > would be more expensive.
A separate pass would be very considerably more expensive, because (1) it would require making a whole new copy of each expression tree, and (2) it would require looking up the volatility status of each function and operator. eval_const_expressions already has to do the latter, or has to do it in a lot of cases anyway, so I think it's probably the best place to add this. If it weren't for (2) I would suggest adding the work to setrefs.c instead, but as it is I think we'd better suck it up and deal with any fallout in the later stages of the planner. regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers