Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCjhd-00H3VC-6a for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Dec 2023 17:04:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rCjhb-00FXMZ-Jn for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Dec 2023 17:04:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCjhb-00FXLl-Ap for pgsql-bugs@lists.postgresql.org; Mon, 11 Dec 2023 17:04:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCjhZ-00BPeF-5y for pgsql-bugs@lists.postgresql.org; Mon, 11 Dec 2023 17:04:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BBH4D122286799; Mon, 11 Dec 2023 12:04:13 -0500 From: Tom Lane To: Shvidky Andrey cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: daterange constructor vs cast In-reply-to: References: Comments: In-reply-to Shvidky Andrey message dated "Mon, 11 Dec 2023 16:14:38 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2286797.1702314253.1@sss.pgh.pa.us> Date: Mon, 11 Dec 2023 12:04:13 -0500 Message-ID: <2286798.1702314253@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Shvidky Andrey 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