Re: relhassubclass and partitioned indexes
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-10-22T02:09:09Z
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
Commits
-
Set pg_class.relhassubclass for partitioned indexes
- 17f206fbc824 12.0 landed