On Tue, September 13, 2011 10:41, Jeff Davis wrote:
> Another updated patch is attached.
>
Hi,
Below are 2 changes. The first change is an elog saying 'lower' instead of 'upper'.
The second change is less straightforward, but I think it should be changed too:
Rangetypes as it stands uses NULL to indicate INF or -INF:
select int4range(2, NULL);
int4range
------------[ 2, INF )
(1 row)
but refuses to accept it in the string-form:
select '[ 2 , NULL )'::int4range;
ERROR: NULL range boundaries are not supported
LINE 1: select '[ 2 , NULL )'::int4range; ^
Second part below changes that to accept NULL for INF and -INF
in the string-form construction. (not complete: it still is
case-sensitive).
Thanks,
Erik Rijkers
--- src/backend/utils/adt/rangetypes.c.orig 2011-09-18 12:35:29.000000000 +0200
+++ src/backend/utils/adt/rangetypes.c 2011-09-18 16:03:34.000000000 +0200
@@ -387,7 +387,7 @@ if (empty) elog(ERROR, "range is empty"); if (upper.infinite)
- elog(ERROR, "range lower bound is infinite");
+ elog(ERROR, "range upper bound is infinite");
PG_RETURN_DATUM(upper.val);}
@@ -1579,9 +1579,9 @@ fl = RANGE_EMPTY;
if (!lb_quoted && strncmp(lb, "NULL", ilen) == 0)
- elog(ERROR, "NULL range boundaries are not supported");
+ fl |= RANGE_LB_INF; if (!ub_quoted && strncmp(ub, "NULL", ilen) == 0)
- elog(ERROR, "NULL range boundaries are not supported");
+ fl |= RANGE_UB_INF; if (!lb_quoted && strncmp(lb, "-INF", ilen) == 0) fl |=
RANGE_LB_INF; if (!ub_quoted && strncmp(ub, "INF", ilen) == 0)