aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/nodes/bitmapset.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index 9bf9a29d6b1..6208f4ed936 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -867,6 +867,10 @@ bms_add_range(Bitmapset *a, int lower, int upper)
ushiftbits,
wordnum;
+ /* do nothing if nothing is called for, without further checking */
+ if (upper < lower)
+ return a;
+
if (lower < 0 || upper < 0)
elog(ERROR, "negative bitmapset member not allowed");
if (lower > upper)
@@ -878,13 +882,12 @@ bms_add_range(Bitmapset *a, int lower, int upper)
a = (Bitmapset *) palloc0(BITMAPSET_SIZE(uwordnum + 1));
a->nwords = uwordnum + 1;
}
-
- /* ensure we have enough words to store the upper bit */
else if (uwordnum >= a->nwords)
{
int oldnwords = a->nwords;
int i;
+ /* ensure we have enough words to store the upper bit */
a = (Bitmapset *) repalloc(a, BITMAPSET_SIZE(uwordnum + 1));
a->nwords = uwordnum + 1;
/* zero out the enlarged portion */