Skip to content

Commit 2aaae1e

Browse files
committed
pathman: fix operations with ranges (by Alexander Korotkov)
1 parent 5f4da06 commit 2aaae1e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

contrib/pg_pathman/rangeset.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
bool
1414
irange_intersects(IndexRange a, IndexRange b)
1515
{
16-
return (irange_lower(a) <= irange_upper(b)) ||
16+
return (irange_lower(a) <= irange_upper(b)) &&
1717
(irange_lower(b) <= irange_upper(a));
1818
}
1919

2020
/* Check if two ranges are conjuncted */
2121
bool
2222
irange_conjuncted(IndexRange a, IndexRange b)
2323
{
24-
return (irange_lower(a) - 1 <= irange_upper(b)) ||
24+
return (irange_lower(a) - 1 <= irange_upper(b)) &&
2525
(irange_lower(b) - 1 <= irange_upper(a));
2626
}
2727

@@ -44,6 +44,27 @@ irange_intersect(IndexRange a, IndexRange b)
4444
irange_is_lossy(a) || irange_is_lossy(b));
4545
}
4646

47+
#ifdef NOT_USED
48+
/* Print range list in debug purposes */
49+
static char *
50+
print_irange(List *l)
51+
{
52+
ListCell *c;
53+
StringInfoData str;
54+
55+
initStringInfo(&str);
56+
57+
foreach (c, l)
58+
{
59+
IndexRange ir = lfirst_irange(c);
60+
61+
appendStringInfo(&str, "[%d,%d]%c ", irange_lower(ir), irange_upper(ir),
62+
irange_is_lossy(ir) ? 'l' : 'e');
63+
}
64+
return str.data;
65+
}
66+
#endif
67+
4768
/*
4869
* Make union of two index rage lists.
4970
*/

0 commit comments

Comments
 (0)