Re: pointless check in RelationBuildPartitionDesc

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pointless check in RelationBuildPartitionDesc
Date: 2018-09-04 06:19:59
Message-ID: d72552fa-61c6-c981-e04a-6e5079db0a2c@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018/09/04 13:08, Alvaro Herrera wrote:
> On 2018-Sep-04, Amit Langote wrote:
>
>> On 2018/09/04 10:19, Michael Paquier wrote:
>>> On Tue, Sep 04, 2018 at 09:47:07AM +0900, Amit Langote wrote:
>>>> On 2018/09/04 6:39, Alvaro Herrera wrote:
>>>>> After looking, it seems that this is just self-inflicted pain: for some
>>>>> reason, we store the pg_inherits row for a partition, and immediately
>>>>> afterwards compute and store its partition bound, which requires the
>>>>> above hack. But if we do things in the opposite order, this is no
>>>>> longer needed. I propose to remove it, as in the attached patch.
>>>>
>>>> +1. I remember having facepalmed at this before and had also written a
>>>> patch but never got around to submitting it.
>>>
>>> Ok, I see. It seems to me that this could be replaced by an
>>> elog(ERROR), as relispartition ought to be set anyway. This way any
>>> future callers would get things done in the correct order.
>>
>> Converting it to elog(ERROR, ...) might be a good idea.
>
> I think it'd be pointless noise. If we really want to protect against
> that, I think we should promote the Assert for relpartbound's isnull
> flag into an if test.

So that we can elog(ERROR, ...) if isnull is true? If so, I agree,
because that's what should've been done here anyway (for a value read from
the disk that is). I think we should check relispartition then too.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2018-09-04 06:21:02 Re: MERGE SQL statement for PG12
Previous Message Kato, Sho 2018-09-04 05:45:24 RE: speeding up planning with partitions