Re: pointless check in RelationBuildPartitionDesc

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pointless check in RelationBuildPartitionDesc
Date: 2018-09-04 00:47:07
Message-ID: 380c6b65-8b7f-d8c4-828f-715be111d781@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018/09/04 6:39, Alvaro Herrera wrote:
> I noticed this strange hack in RelationBuildPartitionDesc:
>
> /*
> * It is possible that the pg_class tuple of a partition has not been
> * updated yet to set its relpartbound field. The only case where
> * this happens is when we open the parent relation to check using its
> * partition descriptor that a new partition's bound does not overlap
> * some existing partition.
> */
> if (!((Form_pg_class) GETSTRUCT(tuple))->relispartition)
> {
> ReleaseSysCache(tuple);
> continue;
> }
>
> 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.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-09-04 00:49:00 Re: Slotification of partition tuple conversion
Previous Message Masahiko Sawada 2018-09-04 00:42:20 Re: [HACKERS] Restricting maximum keep segments by repslots