Konstantin Knizhnik <k.knizhnik@postgrespro.ru> writes:
> Frankly speaking I do not see some good reasons for not handling
> RestrictInfo in expression_tree_worker. It can really simplify writing
> of mutators/walkers.
I don't buy this; what seems more likely is that you're trying to apply
an expression tree mutator to something you shouldn't. The caching
aspects of RestrictInfo, and the fact that the planner often assumes
that RestrictInfos don't get copied (so that pointer equality is a
useful test), are both good reasons to be wary of applying general
mutations to those nodes.
Or in other words, if you want a walker/mutator to descend through
those nodes, you almost certainly need special logic at those nodes
anyway. Omitting them from the nodeFuncs support guarantees you
don't forget that.
regards, tom lane