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 1miQIA-0004AX-U1 for pgsql-general@arkaria.postgresql.org; Thu, 04 Nov 2021 00:07:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1miQI9-0000K0-Lk for pgsql-general@arkaria.postgresql.org; Thu, 04 Nov 2021 00:07:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miQI9-0000Jl-C7 for pgsql-general@lists.postgresql.org; Thu, 04 Nov 2021 00:07:41 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miQI7-0006KK-Ag for pgsql-general@lists.postgresql.org; Thu, 04 Nov 2021 00:07:40 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B83AA5C01DC; Wed, 3 Nov 2021 20:07:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 03 Nov 2021 20:07:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:from:to:cc:references :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=r bmbe5D2rDBgMvF0kO4uC31jxX6chyclZ9VQje89Z88=; b=FD3B6Pj4ohY3eep0y 3Je1jqtGEOUHMklVimyD9/hGNhSb4idobgAvGfNXmG/7APQng9f3At4//UByoosY IF5L5qHJCcggUGX7otc/tUEDoLrUCuDes3nO6blWuVAx87dVM7qYfj3pbKPGREGP 3XbRQhJYftNTmsDjpFeurP0S8QPVngAQaJ3ME/EMFmejmwee3TB5J/Vc7zrtpEUP qrpZFsrIyvb6X9uBGuuLy7cWr9PWYsMLEWQ6p+n6NsNC8aP4FZTN+Zy0zSZQuxhb /SJIzCe4Ox7e1913es3tJyKxoUv+qQS/XBsojVn6d1yZ2OS43Z9jGwo9n4OJF7Qb T0wBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=rbmbe5D2rDBgMvF0kO4uC31jxX6chyclZ9VQje89Z 88=; b=Aj+Wg3c1vUuWks4imi8G0AfEVjavS7ioCxMyCeUP8QQRAnJ7uuPJOqdEM 9CcX7pauZoTHa0j1uAZDQsZBRGiopw90gq7kvCw5bSLVQHfyd3UUqE9430hy5Umd 905QihlN4xKVLJC/fqjDnWM/PRSMIbLsEqrgs+pE57R1+sJuFS/aCaQSo0ZK+ItU 0y5DrRLVdZB7APA83gODOF0+lN/N/k0cqigEjwjZEd6TLXio1o3I9ZKhIOre2F6l 3L5MjfG+EGRi1PoYG8K7sPgFWmw2feDfyBNcCchI2x63miZ3/4P/zxBKD7PK8tuz NkRm4BwfiyVbMCGwdwDvsrIClUwdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrtdefgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuhffvfhgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepleejvdelgfelgeejgeejiefhtdejhfehgeeghedvjeej ffefvefhffdtgefhffejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Nov 2021 20:07:37 -0400 (EDT) Message-ID: <30ba14d1-31fc-31ac-aaff-ac42589d7a07@aklaver.com> Date: Wed, 3 Nov 2021 17:07:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: to_date() and to_timestamp() with negative years Content-Language: en-US From: Adrian Klaver To: Bryn Llewellyn , Tom Lane PostgreSQL Cc: pgsql-general list References: <138332.1635962086@sss.pgh.pa.us> <08E63AD5-8E6D-4140-AE1C-9DC22324A287@yugabyte.com> <72204b8f-41b2-0004-b09b-842f8c57477f@aklaver.com> <0B75398B-91CC-4074-B77A-390AA157685B@yugabyte.com> <265331.1635978234@sss.pgh.pa.us> <745E3531-6791-4964-AF68-BC82FC2EC864@yugabyte.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/3/21 17:00, Adrian Klaver wrote: > On 11/3/21 15:56, Bryn Llewellyn wrote: >>> tgl@sss.pgh.pa.us wrote: >>> >> And you have to have some kind of separator between the years >> substring and the adjacent one(s) even to succeed with years that have >> more than four digits. Another usage note stresses that while this is OK: >> >> select to_date('12340101', 'YYYYMMDD'); >> >> this isn't: >> >> select to_date('123450101', 'YYYYMMDD'); > > It does with a tweak: > > select to_date('12345 0101', 'FMYYYYMMDD'); >    to_date > ------------- >  12345-01-01 Well that was just plain wrong. I was not paying attention. -- Adrian Klaver adrian.klaver@aklaver.com