pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Shvidky Andrey <andrey_shvidky@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: daterange constructor vs cast
Date: Mon, 11 Dec 2023 12:04:13 -0500
Message-ID: <2286798.1702314253@sss.pgh.pa.us> (raw)
In-Reply-To: <AM9P195MB09039825DC2F6BC4F13A78C8E78FA@AM9P195MB0903.EURP195.PROD.OUTLOOK.COM>
References: <AM9P195MB09039825DC2F6BC4F13A78C8E78FA@AM9P195MB0903.EURP195.PROD.OUTLOOK.COM>

Shvidky Andrey <andrey_shvidky@hotmail.com> writes:
> Aren't these 6 results must be the same?

I think you have the wrong idea of how range constructors work.
This:

>        daterange('[20231211', '20231211]')
>        ,daterange('[20231211', '20231212)')

is not valid input really.  It happens to not fail because date_in
ignores garbage punctuation; but nothing is considering those
brackets or parens as indicating range end types.

These are the approved way to do it:

>        ,daterange('20231211', '20231211', '[]')
>        ,daterange('20231211', '20231212', '[)')

			regards, tom lane





view thread (2+ messages)

Message-ID: <2286798.1702314253@sss.pgh.pa.us>
Permalink:  ../2286798.1702314253@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2286798.1702314253@sss.pgh.pa.us

 · 

reply

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, andrey_shvidky@hotmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: daterange constructor vs cast
  In-Reply-To: <2286798.1702314253@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