Hi,
On Wed, Aug 7, 2019 at 5:07 PM Konstantin Knizhnik
<k.knizhnik@postgrespro.ru> wrote:
> On 07.08.2019 10:42, Amit Langote wrote:
> > You may also want to read this discussion:
> >
> > https://www.postgresql.org/message-id/553FC9BC.5060402%402ndquadrant.com
> >
> Thank you very much for response and pointing me to this thread.
> Unfortunately I do not understand from this thread how the problem was
> solved with pullvars - right now pull_varnos_walker and
> pull_varattnos_walker
> are not handling RestrictInfo.
>
> Also I do not completely understand the argument "RestrictInfo is not a
> general expression node and support for it has
> been deliberately omitted from expression_tree_walker()". If there is
> BoolOp expression which contains RestrictInfo expression as it
> arguments, then either this expression is not
> correct, either RestrictInfo should be considered as "expression node".
>
> 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.
> And I do not think that reporting error instead of handling this tag
> adds some extra safety or error protection.
Well, Tom has expressed in various words in that thread that expecting
to successfully run expression_tree_walker() on something containing
RestrictInfos may be a sign of bad design somewhere in the code that
you're trying to add. I have recollections of submitting such code,
but later realizing that there's some other way to do things
differently that doesn't require walking expressions containing
RestrictInfos.
Btw, looking at the example walker function you've shown in the first
email, maybe you want to use a mutator, not a walker. The latter
class of functions is only supposed to inspect the input tree, not
modify it.
Thanks,
Amit