Re: daterange() is ignoring 3rd boundaries argument

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: rk(at)marksim(dot)org
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: daterange() is ignoring 3rd boundaries argument
Date: 2022-11-29 00:35:32
Message-ID: CAKFQuwaT+c7J956RGmspTk+Cw5Ah_nuiftXZWhOLv3R-O97FjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Nov 28, 2022 at 5:16 PM Robert KOFLER <rk(at)marksim(dot)org> wrote:

> 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)
>

You need to look at the boundary symbol AND the actual lower bound date.

Then read the following about discrete range types for what is happening
here:

https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DISCRETE

> from manual: 8.17.6. Constructing Ranges and Multiranges
>

Yes, that tells you how to take "text" and turn it into a datum of type
*range. Is discusses input only, not output. Output depends on the
specific type and, as noted above, in particular whether it is discrete or
continuous.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-11-29 00:42:24 Re: daterange() is ignoring 3rd boundaries argument
Previous Message Richard Guo 2022-11-29 00:12:16 Re: BUG #17700: An assert failed in prepjointree.c