From: Tom Lane <tgl@sss.pgh.pa.us>
To: rk@marksim.org
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: daterange() is ignoring 3rd boundaries argument
Date: Mon, 28 Nov 2022 19:42:24 -0500
Message-ID: <778131.1669682544@sss.pgh.pa.us> (raw)
In-Reply-To: <adb48d1b-0993-0921-9f08-c34ba8333a39@marksim.org>
References: <adb48d1b-0993-0921-9f08-c34ba8333a39@marksim.org>
Robert KOFLER <rk@marksim.org> writes:
> select daterange('2022-11-01'::date, '2023-01-31'::date, '()')
> returns
> [2022-11-02,2023-01-31) which is deafult of [)
> instead of
> (2022-11-02,2023-01-31)
It's not "ignoring" the endpoint argument, because you get different
results from
regression=# select daterange('2022-11-01'::date, '2023-01-31'::date, '()');
daterange
-------------------------
[2022-11-02,2023-01-31)
(1 row)
regression=# select daterange('2022-11-01'::date, '2023-01-31'::date, '[)');
daterange
-------------------------
[2022-11-01,2023-01-31)
(1 row)
regression=# select daterange('2022-11-01'::date, '2023-01-31'::date, '[]');
daterange
-------------------------
[2022-11-01,2023-02-01)
(1 row)
As explained somewhere in the fine manual (though not in the exact spot
you're reading), for ranges over discrete types such as dates, we prefer
to normalize to the '[)' endpoint conventions. That's not possible for
continuous types such as floats or timestamps, so in those cases we
leave the endpoint specs alone.
If that really annoys you, you can make your own range type over
dates that lacks a "canonical" function. But it's not a bug;
it's operating as intended.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, rk@marksim.org, pgsql-bugs@lists.postgresql.org
Subject: Re: daterange() is ignoring 3rd boundaries argument
In-Reply-To: <778131.1669682544@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox