Re: Range Types - typo + NULL string constructor

Поиск
Список
Период
Сортировка
От Erik Rijkers
Тема Re: Range Types - typo + NULL string constructor
Дата
Msg-id 7ef6f6827f610eb087894f406f695c26.squirrel@webmail.xs4all.nl
обсуждение исходный текст
Ответ на Re: Range Types  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: Range Types - typo + NULL string constructor
Список 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)
 




В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: 2011-09 CF underway
Следующее
От: Tom Lane
Дата:
Сообщение: Re: /proc/self/oom_adj is deprecated in newer Linux kernels