diff options
Diffstat (limited to 'src/backend/utils/adt/partitionfuncs.c')
-rw-r--r-- | src/backend/utils/adt/partitionfuncs.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/backend/utils/adt/partitionfuncs.c b/src/backend/utils/adt/partitionfuncs.c index 36d9f69cbcc..a2fe4f34b6d 100644 --- a/src/backend/utils/adt/partitionfuncs.c +++ b/src/backend/utils/adt/partitionfuncs.c @@ -35,17 +35,17 @@ static bool check_rel_can_be_partition(Oid relid) { char relkind; + bool relispartition; /* Check if relation exists */ if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relid))) return false; relkind = get_rel_relkind(relid); + relispartition = get_rel_relispartition(relid); /* Only allow relation types that can appear in partition trees. */ - if (relkind != RELKIND_RELATION && - relkind != RELKIND_FOREIGN_TABLE && - relkind != RELKIND_INDEX && + if (!relispartition && relkind != RELKIND_PARTITIONED_TABLE && relkind != RELKIND_PARTITIONED_INDEX) return false; @@ -189,13 +189,6 @@ pg_partition_root(PG_FUNCTION_ARGS) if (!check_rel_can_be_partition(relid)) PG_RETURN_NULL(); - /* - * If the relation is not a partition (it may be the partition parent), - * return itself as a result. - */ - if (!get_rel_relispartition(relid)) - PG_RETURN_OID(relid); - /* Fetch the top-most parent */ ancestors = get_partition_ancestors(relid); rootrelid = llast_oid(ancestors); |