Re: [Bug] Inconsistent result for inheritance and FOR UPDATE. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.
Date
Msg-id 17534.1418348254@sss.pgh.pa.us
Whole thread Raw
In response to [Bug] Inconsistent result for inheritance and FOR UPDATE.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: double vacuum in initdb
Next
From: Etsuro Fujita
Date:
Subject: Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.