Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSQPf-0000eq-Ue for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Feb 2023 22:38:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSQOe-0005LF-PM for pgsql-bugs@arkaria.postgresql.org; Wed, 15 Feb 2023 22:37:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSQOe-0005L6-Gi for pgsql-bugs@lists.postgresql.org; Wed, 15 Feb 2023 22:37:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pSQOb-0001Oz-JS for pgsql-bugs@lists.postgresql.org; Wed, 15 Feb 2023 22:37:03 +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 31FMawdL2137696; Wed, 15 Feb 2023 17:36:58 -0500 From: Tom Lane To: David Rowley cc: postgresql@richardneill.org, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17794: dates with zero or negative years are not accepted In-reply-to: References: <17794-1ddd1f50f9df08a1@postgresql.org> Comments: In-reply-to David Rowley message dated "Thu, 16 Feb 2023 11:06:47 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2137694.1676500618.1@sss.pgh.pa.us> Date: Wed, 15 Feb 2023 17:36:58 -0500 Message-ID: <2137695.1676500618@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > From an implementation point of view, it looks trivial to just allow > 0000 to mean 1 BC, however, the situation is more complex for negative > numbers as ParseDateTime() sees the negative sign and categorises that > portion as a timezone. The parsing would have to be adjusted to make > this be seen as a year, and that'll cause us to suddenly start > interpreting date strings differently from what we do now, which risks > breaking applications. I'm not sure that's worth the risk. Yeah, the real problem is that getting '-' to be seen as part of the year field will cause havoc in the parsing rules. I'd say if you want this sort of input, use make_date() or make_timestamptz() rather than going through string form. regards, tom lane