Fix re-partition hash range generation

pull/5400/head
Marco Slot 2021-11-07 23:54:44 +01:00
parent 72d8fde28b
commit 5ac0d31e8b
1 changed files with 6 additions and 0 deletions

View File

@ -4538,6 +4538,12 @@ GenerateSyntheticShardIntervalArray(int partitionCount)
int32 shardMinHashToken = PG_INT32_MIN + (shardIndex * hashTokenIncrement);
int32 shardMaxHashToken = shardMinHashToken + (hashTokenIncrement - 1);
/* extend the last range to cover the full range of integers */
if (shardIndex == (partitionCount - 1))
{
shardMaxHashToken = PG_INT32_MAX;
}
shardInterval->relationId = InvalidOid;
shardInterval->minValueExists = true;
shardInterval->minValue = Int32GetDatum(shardMinHashToken);