summaryrefslogtreecommitdiff
path: root/src/include/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-22 16:05:49 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-22 16:06:26 -0500
commit766948beddef66dd89563f465919eca6e131861c (patch)
treefdc3c92fab62f0ce28abf6af7f4d8705381aa5fc /src/include/utils
parent024ea25ccd553aa0ecb41d626a1016470e25a9a0 (diff)
Still more review for range-types patch.
Per discussion, relax the range input/construction rules so that the only hard error is lower bound > upper bound. Cases where the lower bound is <= upper bound, but the range nonetheless normalizes to empty, are now permitted. Fix core dump in range_adjacent when bounds are infinite. Marginal cleanup of regression test cases, some more code commenting.
Diffstat (limited to 'src/include/utils')
-rw-r--r--src/include/utils/rangetypes.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/utils/rangetypes.h b/src/include/utils/rangetypes.h
index 7d826d55210..f64f7c887e3 100644
--- a/src/include/utils/rangetypes.h
+++ b/src/include/utils/rangetypes.h
@@ -49,6 +49,8 @@ typedef struct
RANGE_UB_NULL | \
RANGE_UB_INF)))
+#define RangeIsEmpty(r) (range_get_flags(r) & RANGE_EMPTY)
+
/* Internal representation of either bound of a range (not what's on disk) */
typedef struct
@@ -153,7 +155,10 @@ extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower,
RangeBound *upper, bool empty);
extern int range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1,
RangeBound *b2);
+extern int range_cmp_bound_values(TypeCacheEntry *typcache, RangeBound *b1,
+ RangeBound *b2);
extern RangeType *make_empty_range(TypeCacheEntry *typcache);
+extern RangeType *make_singleton_range(TypeCacheEntry *typcache, Datum val);
/* GiST support (in rangetypes_gist.c) */
extern Datum range_gist_consistent(PG_FUNCTION_ARGS);