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 1iHrZc-0000j6-4M for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Oct 2019 15:38:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHrZZ-0003MK-Mv for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Oct 2019 15:38:49 +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 1iHrZZ-0003M3-BV for pgsql-bugs@lists.postgresql.org; Tue, 08 Oct 2019 15:38:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iHrZW-0001um-GK for pgsql-bugs@lists.postgresql.org; Tue, 08 Oct 2019 15:38:47 +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 x98Fci07022302; Tue, 8 Oct 2019 11:38:44 -0400 From: Tom Lane To: Pavel Pleva cc: pgsql-bugs@lists.postgresql.org Subject: Re: Potential to_date(string, string) function malfunction In-reply-to: <05d1d8b7-d1de-1ec7-7652-5b7ff5deaa65@gmail.com> References: <05d1d8b7-d1de-1ec7-7652-5b7ff5deaa65@gmail.com> Comments: In-reply-to Pavel Pleva message dated "Tue, 08 Oct 2019 14:30:56 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22300.1570549124.1@sss.pgh.pa.us> Date: Tue, 08 Oct 2019 11:38:44 -0400 Message-ID: <22301.1570549124@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pavel Pleva writes: > I'd like to report you in my opinion weird behaviour of function > to_date(string, string). According to specs using format 'YYYY-MM-DD' in > months portion it should tolerate 01-12 and in days portion 01-31. But > if you try "SELECT to_date('2019-30-50', 'YYYY-MM-DD') instead of > throwing error it outputs "2021-07-23". > This is output of 'SELECT version();' on our system: "PostgreSQL 9.4.23 > on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red > Hat 4.8.5-36), 64-bit" PG v10 and later throw an error for this. regards, tom lane