Skip to content

Commit 02402f9

Browse files
author
Alexander Korotkov
committed
Add handling of case when we hit the gap between partitions.
1 parent 0aa8234 commit 02402f9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/pg_pathman.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,24 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
997997
/* If we still didn't find partition then it doesn't exist */
998998
if (startidx >= endidx)
999999
{
1000+
/* Handle case when we hit the gap between partitions */
1001+
if (strategy != BTEqualStrategyNumber)
1002+
{
1003+
if (strategy == BTLessStrategyNumber ||
1004+
strategy == BTLessEqualStrategyNumber)
1005+
{
1006+
if (is_less && i > 0)
1007+
i--;
1008+
}
1009+
if (strategy == BTGreaterStrategyNumber ||
1010+
strategy == BTGreaterEqualStrategyNumber)
1011+
{
1012+
if (is_greater && i < rangerel->ranges.length - 1)
1013+
i++;
1014+
}
1015+
lossy = false;
1016+
break;
1017+
}
10001018
result->rangeset = NIL;
10011019
return;
10021020
}

0 commit comments

Comments
 (0)