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 1o0lEW-0000fU-Js for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2022 14:40:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o0lEV-00043h-Dp for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2022 14:39:59 +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 1o0lEU-00043S-P0 for pgsql-hackers@lists.postgresql.org; Mon, 13 Jun 2022 14:39:59 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o0lEQ-00008V-RG for pgsql-hackers@postgresql.org; Mon, 13 Jun 2022 14:39:57 +0000 Received: by fetter.org (Postfix, from userid 1001) id A39F04186E; Mon, 13 Jun 2022 14:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fetter.org; s=default; t=1655131192; bh=+kIT3TC1zLpUJAc0IBtYlZVKGjA0ZJFG/PlVRwEZC6k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ono8010fzkjYU4KpuVujV7JYqnvd1WINO8w9zkTzZRV4rGqR8/2A44iMAkL/m6I3/ iNQId9akLZm7eueMqTlj++AIeZa38oVp+t2t54MskZUtQdYAo7cgev8HocwFfOl1bQ L56o/ToWSn1UXL/JYBguN+ZI6xCCUy7EtmNevKLQrQCm9QfFlRIXhWPhFW9lSPc490 rApfAHkWncl2eQ6pqKqGKdXmcdqEo8v+t+AXSzqn0LaAAjTMidNnucQOzrkm9CUbvo ieHETYv8poqJsC4mMak7DoVPBefFJ2029PVcG2P/D3q1cHyDpW28h1IQw5SDhZrf9y /dPsBiGJ/tZRQ== Date: Mon, 13 Jun 2022 14:39:52 +0000 From: David Fetter To: Erik Rijkers Cc: PostgreSQL Development Subject: Re: Parse CE and BCE in dates and times Message-ID: <20220613143951.GD12494@fetter.org> References: <20220613055136.GB12494@fetter.org> <07c4a60d-d7b9-146b-9d10-faa0b09fd2ee@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <07c4a60d-d7b9-146b-9d10-faa0b09fd2ee@xs4all.nl> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jun 13, 2022 at 09:11:56AM +0200, Erik Rijkers wrote: > Op 13-06-2022 om 07:51 schreef David Fetter: > > Folks, > > > > Please find attached a patch to do $Subject. As dates in a fair number > > of fields of endeavor are expressed this way, it seems reasonable to > > ensure tha we can parse them on input. Making it possible to use them > > in output is a more invasive patch, and would involve changes to > > to_date and similar that would require careful consideration. > > Hi David, > > I find some unexpected results: > > # select '112-04-30 BC'::date; > date > --------------- > 0112-04-30 BC > (1 row) > > but the same with the ' BCE' suffix seems broken: > > # select '112-04-30 BCE'::date; > ERROR: invalid input syntax for type date: "112-04-30 BCE" > LINE 1: select '112-04-30 BCE'::date; > > The same goes for '112-04-30 AD' (works) and its CE version (errors out). > > Or is this as expected? It's not, and thanks for looking at this. Will check to see what's going on here. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate