Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6e9k-00065k-96 for pgsql-general@arkaria.postgresql.org; Wed, 20 Mar 2019 16:33:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6e9h-0005Nb-B6 for pgsql-general@arkaria.postgresql.org; Wed, 20 Mar 2019 16:33:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6e9g-0005C5-R7 for pgsql-general@lists.postgresql.org; Wed, 20 Mar 2019 16:33:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6e9a-0001ss-3y for pgsql-general@lists.postgresql.org; Wed, 20 Mar 2019 16:33:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x2KGXKhJ010069; Wed, 20 Mar 2019 12:33:20 -0400 From: Tom Lane To: Gustavsson Mikael cc: "pgsql-general@lists.postgresql.org" Subject: Re: to_timestamp function In-reply-to: <89DE7C43D727C04CA77C8B7AB82533CD022B4935BF@WINVMSERV464.ad.smhi.se> References: <89DE7C43D727C04CA77C8B7AB82533CD022B4935BF@WINVMSERV464.ad.smhi.se> Comments: In-reply-to Gustavsson Mikael message dated "Wed, 20 Mar 2019 16:12:49 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10067.1553099600.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 20 Mar 2019 12:33:20 -0400 Message-ID: <10068.1553099600@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Gustavsson Mikael writes: > So my question is, is it intentional that to_timestamp is stricter than = cast to timestamp? Yes. The point of using that function at all is to be strict about the input format, so being strict about the field values seems to make sense along with that. An independent argument for it is mentioned in the commit message (d3cd36a13): = Historically, something like to_date('2009-06-40','YYYY-MM-DD') would return '2009-07-10' because there was no prohibition on out-of-range month or day numbers. This has been widely panned, and it also turns out that Oracle throws an error in such cases. Since these functions are nominally Oracle-compatibility features, let's change that. regards, tom lane