From c9809da4d7ae33d55b065f667da3ab0f193f13a5 Mon Sep 17 00:00:00 2001 From: Brian Cloutier Date: Thu, 20 Oct 2016 15:08:09 +0300 Subject: [PATCH] Fix crash when upgrading to Citus 6 Between restart (running the new code) and ALTER EXTENSION citus UPGRADE there was an inconsistency where we assumed that pg_dist_partition had the repmodel column set. Now we give it a default value if the column doesn't exist yet. --- src/backend/distributed/utils/metadata_cache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/utils/metadata_cache.c b/src/backend/distributed/utils/metadata_cache.c index 8ae60fd89..5170aabf0 100644 --- a/src/backend/distributed/utils/metadata_cache.c +++ b/src/backend/distributed/utils/metadata_cache.c @@ -338,7 +338,15 @@ LookupDistTableCacheEntry(Oid relationId) Anum_pg_dist_partition_repmodel, tupleDescriptor, &isNull); - Assert(!isNull); + + if (isNull) + { + /* + * repmodel is NOT NULL but before ALTER EXTENSION citus UPGRADE the column + * doesn't exist + */ + replicationModelDatum = CharGetDatum('c'); + } oldContext = MemoryContextSwitchTo(CacheMemoryContext); partitionKeyString = TextDatumGetCString(partitionKeyDatum);