Re: relhassubclass and partitioned indexes

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: relhassubclass and partitioned indexes
Date: 2018-10-22 02:09:09
Message-ID: 20181022020909.GD14282@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 19, 2018 at 06:46:15PM +0900, Amit Langote wrote:
> Thanks. Attached a patch to set relhassubclass when an index partition is
> added to a partitioned index.

Thanks, committed after adding a test with ALTER TABLE ONLY, and
checking upgrades as well as ATTACH partition for ALTER INDEX and ALTER
TABLE. In all cases the same code paths are taken.

> /* update pg_inherits, if needed */
> if (OidIsValid(parentIndexRelid))
> + {
> StoreSingleInheritance(indexRelationId, parentIndexRelid, 1);
>
> + /* Also, set the parent's relhassubclass. */
> + SetRelationHasSubclass(parentIndexRelid, true);
> + }

Calling SetRelationHasSubclass() updates pg_class for this parent
relation. We would need CommandCounterIncrement() if the tuple gets
updated, but that's not the case as far as I checked for all code paths
where this gets called. This would be seen immediately by the way..
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-10-22 02:50:32 Re: relhassubclass and partitioned indexes
Previous Message Andres Freund 2018-10-22 01:01:05 Re: found xmin x from before relfrozenxid y