aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-05-09 23:51:54 -0400
committerRobert Haas <rhaas@postgresql.org>2017-05-09 23:53:35 -0400
commit622c82279dcba1208049b8b9ae93023757a2dbbe (patch)
tree117f20525b1c3bb14caad212a6495c2c03a817f7 /src/backend/utils/cache/relcache.c
parente17628145ac33bf271b3f575b52cdbe9dde0bb80 (diff)
downloadpostgresql-622c82279dcba1208049b8b9ae93023757a2dbbe.tar.gz
postgresql-622c82279dcba1208049b8b9ae93023757a2dbbe.zip
Avoid theoretical infinite loop loading relcache partition key.
Amit Langote, per report from 甄明洋 Discussion: http://postgr.es/m/57bd1e1.1886.15bd7b79cee.Coremail.18612389267@yeah.net
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 30789c1edc5..c3721d9e431 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -3858,13 +3858,20 @@ RelationCacheInitializePhase3(void)
}
/*
- * Reload partition key and descriptor for a partitioned table.
+ * Reload the partition key and descriptor for a partitioned table.
*/
- if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
+ if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
+ relation->rd_partkey == NULL)
{
RelationBuildPartitionKey(relation);
Assert(relation->rd_partkey != NULL);
+ restart = true;
+ }
+
+ if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
+ relation->rd_partdesc == NULL)
+ {
RelationBuildPartitionDesc(relation);
Assert(relation->rd_partdesc != NULL);