On Tue, Jan 26, 2016 at 4:34 AM, <onderkalaci@gmail.com> wrote:
>
> I guess the problem is on this line (ruletils@5533 on Postgresql 9.5.0
> source)
> https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/ruleutils.c#L5533
>
> I think, postgres should set varprefix to false before calling
> get_rule_expr().
I believe that your analysis is correct. I'll need to look into it in
more detail, but I'm about to get on a transatlantic flight.
I'm curious: How did you find this bug? Did you just stumble upon it?
I think that the deeper problem here may be that parse analysis of the
inference WHERE clause works by reusing infrastructure from CREATE
INDEX. We should consider that there may be further consequences to
that (although there may well not be).
Does the rewritten query actually error? In other words, is your
complaint strictly that deparsing is broken?
--
Peter Geoghegan