From: | "Erik Rijkers" <er(at)xs4all(dot)nl> |
---|---|
To: | "Jeff Davis" <pgsql(at)j-davis(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Range Types - typo + NULL string constructor |
Date: | 2011-09-18 16:08:22 |
Message-ID: | 7ef6f6827f610eb087894f406f695c26.squirrel@webmail.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-09-18 16:21:08 | Re: /proc/self/oom_adj is deprecated in newer Linux kernels |
Previous Message | Kevin Grittner | 2011-09-18 15:46:01 | 2011-09 CF underway |