Re: Redundant check of em_is_child

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Redundant check of em_is_child
Date: 2017-06-23 00:35:19
Message-ID: 9a35203f-8731-2925-ddee-04078541490c@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/06/23 0:00, Robert Haas wrote:
> On Fri, May 19, 2017 at 3:46 AM, Amit Langote
> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>> In match_eclasses_to_foreign_key_col(), there is this:
>>
>> if (em->em_is_child)
>> continue; /* ignore children here */
>>
>> ISTM, it might as well be:
>>
>> Assert(!em->em_is_child); /* no children yet */
>>
>> That's because, I think it's still too early in query_planner() to be
>> expecting any child EC members.
>
> I'm not sure there's really any benefit to this change. In the
> future, somebody might want to use the function from someplace later
> on in the planner. If the logic as-written would work correctly in
> that case now, I can't see why we should turn it into an assertion
> failure instead. This isn't really costing us anything, is it?

Not much perhaps. Just thought it might be an oversight (and potentially
a source of confusion today to someone trying to understand this code),
but no harm in leaving it the way it is, as you say, so that someone in
the future doesn't have to worry about checking here.

Sorry for the noise.

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-06-23 00:35:55 Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS
Previous Message Thom Brown 2017-06-23 00:15:25 Re: Proposal : For Auto-Prewarm.