empty range - Mailing list pgsql-hackers

From david.turon@linuxbox.cz
Subject empty range
Date
Msg-id OFFE3AAF6C.F8631750-ONC12584F1.0033C10F-C12584F1.0033F498@notes.linuxbox.cz
Whole thread Raw
Responses Re: empty range  (Emre Hasegeli <emre@hasegeli.com>)
List pgsql-hackers
Hello,

default constructor for ranges use lower bound closed '[' and upper bound open ')'. This is correct behavior, but when upper bound is same like lower bound then range is empty. Mathematically is correct again - but in database is lost information about range bounds (lower/upper is NULL). To prevent this sitiuation we must have check if lower and upper argument is same and add some 0.00001s  to upper range or use another constructor like tstzrange(now(),now(),'[]') .

Is there chance to change behavior of storing ranges? Its possible store range bounds in internal structure and lower(tstzrange(now(),now())) show not NULL value or change default behavior tstzrange(timestamptz,timestamptz) - if both args are same, then store as '[]', else '[)' and only tstzrange(timestamptz,timestamtz,'[)') and  tstzrange(timestamptz,timestamtz,'()') store empty range.

It's only suggestion, i don't now if somebody wants store empty range without bounds.

We must have some checks to prevent storing empty values on every place where can occur this empty range, becouse we don't want lose bound information.

Best regards,
--
-------------------------------------
Ing. David TUROŇ
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:    +420 591 166 224
fax:    +420 596 621 273
mobil:  +420 732 589 152
www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Option to dump foreign data in pg_dump
Next
From: Andrey Borodin
Date:
Subject: Re: Amcheck: do rightlink verification with lock coupling