Skip to content

Commit 622c822

Browse files
committed
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
1 parent e176281 commit 622c822

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3858,13 +3858,20 @@ RelationCacheInitializePhase3(void)
38583858
}
38593859

38603860
/*
3861-
* Reload partition key and descriptor for a partitioned table.
3861+
* Reload the partition key and descriptor for a partitioned table.
38623862
*/
3863-
if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
3863+
if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
3864+
relation->rd_partkey == NULL)
38643865
{
38653866
RelationBuildPartitionKey(relation);
38663867
Assert(relation->rd_partkey != NULL);
38673868

3869+
restart = true;
3870+
}
3871+
3872+
if (relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE &&
3873+
relation->rd_partdesc == NULL)
3874+
{
38683875
RelationBuildPartitionDesc(relation);
38693876
Assert(relation->rd_partdesc != NULL);
38703877

0 commit comments

Comments
 (0)