summaryrefslogtreecommitdiff
path: root/src/backend/catalog/partition.c
diff options
context:
space:
mode:
authorAlvaro Herrera2018-03-21 15:03:35 +0000
committerAlvaro Herrera2018-03-21 15:03:35 +0000
commit56163004b8b2151db279744b77138d4d90e2d5cb (patch)
tree4bd5973bebede51d9f09def9a2badccd9639b647 /src/backend/catalog/partition.c
parente51a04840a1c45db101686bef0b7025d5014c74b (diff)
Fix relcache handling of the 'default' partition
My commit 4dba331cb3dc that moved around CommandCounterIncrement calls in partitioning DDL code unearthed a problem with the relcache handling for the 'default' partition: the construction of a correct relcache entry for the partitioned table was at the mercy of lack of CCI calls in non-trivial amounts of code. This was prone to creating problems later on, as the code develops. This was visible as a test failure in a compile with RELCACHE_FORCE_RELASE (buildfarm member prion). The problem is that after the mentioned commit it was possible to create a relcache entry that had incomplete information regarding the default partition because I introduced a CCI between adding the catalog entries for the default partition (StorePartitionBound) and the update of pg_partitioned_table entry for its parent partitioned table (update_default_partition_oid). It seems the best fix is to move the latter so that it occurs inside the former; the purposeful lack of intervening CCI should be more obvious, and harder to break. I also remove a check in RelationBuildPartitionDesc that returns NULL if the key is not set. I couldn't find any place that needs this hack anymore; probably it was required because of bugs that have since been fixed. Fix a few typos I noticed while reviewing the code involved. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/catalog/partition.c')
-rw-r--r--src/backend/catalog/partition.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 786c05df737..53855f5088b 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -227,13 +227,6 @@ RelationBuildPartitionDesc(Relation rel)
/* Range partitioning specific */
PartitionRangeBound **rbounds = NULL;
- /*
- * The following could happen in situations where rel has a pg_class entry
- * but not the pg_partitioned_table entry yet.
- */
- if (key == NULL)
- return;
-
/* Get partition oids from pg_inherits */
inhoids = find_inheritance_children(RelationGetRelid(rel), NoLock);