aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/rangetypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/utils/rangetypes.h')
-rw-r--r--src/include/utils/rangetypes.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/include/utils/rangetypes.h b/src/include/utils/rangetypes.h
index c9a6834e6db..307476d9762 100644
--- a/src/include/utils/rangetypes.h
+++ b/src/include/utils/rangetypes.h
@@ -33,13 +33,15 @@ typedef struct
#define RangeTypeGetOid(r) ((r)->rangetypid)
/* A range's flags byte contains these bits: */
-#define RANGE_EMPTY 0x01 /* range is empty */
-#define RANGE_LB_INC 0x02 /* lower bound is inclusive (vs exclusive) */
-#define RANGE_LB_NULL 0x04 /* lower bound is null (NOT CURRENTLY USED) */
-#define RANGE_LB_INF 0x08 /* lower bound is +/- infinity */
-#define RANGE_UB_INC 0x10 /* upper bound is inclusive (vs exclusive) */
-#define RANGE_UB_NULL 0x20 /* upper bound is null (NOT CURRENTLY USED) */
-#define RANGE_UB_INF 0x40 /* upper bound is +/- infinity */
+#define RANGE_EMPTY 0x01 /* range is empty */
+#define RANGE_LB_INC 0x02 /* lower bound is inclusive */
+#define RANGE_UB_INC 0x04 /* upper bound is inclusive */
+#define RANGE_LB_INF 0x08 /* lower bound is -infinity */
+#define RANGE_UB_INF 0x10 /* upper bound is +infinity */
+#define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */
+#define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */
+#define RANGE_CONTAIN_EMPTY 0x80 /* marks a GiST internal-page entry whose
+ * subtree contains some empty ranges */
#define RANGE_HAS_LBOUND(flags) (!((flags) & (RANGE_EMPTY | \
RANGE_LB_NULL | \
@@ -49,7 +51,9 @@ typedef struct
RANGE_UB_NULL | \
RANGE_UB_INF)))
-#define RangeIsEmpty(r) (range_get_flags(r) & RANGE_EMPTY)
+#define RangeIsEmpty(r) ((range_get_flags(r) & RANGE_EMPTY) != 0)
+#define RangeIsOrContainsEmpty(r) \
+ ((range_get_flags(r) & (RANGE_EMPTY | RANGE_CONTAIN_EMPTY)) != 0)
/* Internal representation of either bound of a range (not what's on disk) */
@@ -152,6 +156,7 @@ extern void range_deserialize(TypeCacheEntry *typcache, RangeType *range,
RangeBound *lower, RangeBound *upper,
bool *empty);
extern char range_get_flags(RangeType *range);
+extern void range_set_contain_empty(RangeType *range);
extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower,
RangeBound *upper, bool empty);
extern int range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1,