empty range

From: david(dot)turon(at)linuxbox(dot)cz
To: pgsql-hackers(at)postgresql(dot)org
Subject: empty range
Date: 2020-01-16 09:27:28
Message-ID: OFFE3AAF6C.F8631750-ONC12584F1.0033C10F-C12584F1.0033F498@notes.linuxbox.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)linuxbox(dot)cz
-------------------------------------

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2020-01-16 09:50:28 Re: Amcheck: do rightlink verification with lock coupling
Previous Message vignesh C 2020-01-16 09:01:28 Re: Option to dump foreign data in pg_dump