I reviewed and tested 0001-Dependency-between-partitioned-table-and-partition_v1.patch
It applies cleanly on master and make check passes.
Following are few comments:
>/*
> * Drop the dependency created by StoreCatalogInheritance1 (CREATE TABLE
> * INHERITS/ALTER TABLE INHERIT -- refclassid will be RelationRelationId) or
> * heap_create_with_catalog (CREATE TABLE OF/ALTER TABLE OF -- refclassid will
> * be TypeRelationId). There's no convenient way to do this, so go trawling
> * through pg_depend.
> */
>static void
>drop_parent_dependency(Oid relid, Oid refclassid, Oid refobjid,
DependencyType deptype)
This is not directly related to this patch but still would like to mention.
drop_parent_dependency() is being used to drop the dependency created
by CREATE TABLE PARTITION OF command also, so probably the comment
needs to be modified to reflect that.
>+/*
>+ * Partition tables are expected to be dropped when the parent partitioned
>+ * table gets dropped. Hence for partitioning we use AUTO dependency.
>+ * Otherwise, for regular inheritance use NORMAL dependency.
A minor cosmetic correction:
+ Hence for
declarative partitioning we use AUTO dependency
+ * Otherwise, for regular inheritance
we use NORMAL dependency.
I have added tests to the 0001-Dependency-between-partitioned-table-and-partition_v1.patch. Please find attached the v2 patch.