Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.
Date: 2014-12-12 01:37:34
Message-ID: 17534.1418348254@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2014-12-12 02:05:45 Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.
Previous Message Peter Eisentraut 2014-12-12 01:35:43 Re: double vacuum in initdb