1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Fix bugs in comparison functions for multirange_bsearch_match()

Two functions multirange_range_overlaps_bsearch_comparison() and
multirange_range_contains_bsearch_comparison() contain bugs of returning -1
instead of 1.  This commit fixes these bugs and adds corresponding regression
tests.
This commit is contained in:
Alexander Korotkov
2020-12-29 23:35:26 +03:00
parent 1b3433e25f
commit a5b81b6f00
3 changed files with 16 additions and 2 deletions

View File

@ -1660,7 +1660,7 @@ multirange_range_contains_bsearch_comparison(TypeCacheEntry *typcache,
if (range_cmp_bounds(typcache, keyUpper, lower) < 0)
return -1;
if (range_cmp_bounds(typcache, keyLower, upper) > 0)
return -1;
return 1;
/*
* At this point we found overlapping range. But we have to check if it
@ -1825,7 +1825,7 @@ multirange_range_overlaps_bsearch_comparison(TypeCacheEntry *typcache,
if (range_cmp_bounds(typcache, keyUpper, lower) < 0)
return -1;
if (range_cmp_bounds(typcache, keyLower, upper) > 0)
return -1;
return 1;
*match = true;
return 0;