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.
pull/1938/head
Brian Cloutier 2016-10-20 15:08:09 +03:00 committed by Brian Cloutier
parent c3b10e84ba
commit c9809da4d7
1 changed files with 9 additions and 1 deletions

View File

@ -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);