Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> This is caused by that IndexRecheck examines the test tuple with
> a qual "c = '0'" without "b IN ('0', '1')". The part has been
> removed in create_indexscan_plan. It decieds whether to remove a
> qual or not using get_parse_rowmark(root->parse(->rowMarks)) and
> predicate_implied_by(). But the former always says no (NULL) for
> child relations even if the parent has rowMarks.
> On the other hand, rowmarks on children is already distributed at
> the time by expand_inherited_rtentry() into root->rowMarks.
> So I replaced the get_parse_rowmark() with get_plan_rowmark() as
> the attached patch and the problem disappeared.
Yeah, this is clearly a thinko: really, nothing in the planner should
be using get_parse_rowmark(). I looked around for other errors of the
same type and found that postgresGetForeignPlan() is also using
get_parse_rowmark(). While that's harmless at the moment because we
don't support foreign tables as children, it's still wrong. Will
fix that too.
regards, tom lane