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 1pUEC2-0004kE-D0 for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Feb 2023 21:59:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUEC1-0005Np-8a for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Feb 2023 21:59:29 +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 1pUEC1-0005Ng-03 for pgsql-bugs@lists.postgresql.org; Mon, 20 Feb 2023 21:59:29 +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 1pUEBy-0007oW-Sd for pgsql-bugs@lists.postgresql.org; Mon, 20 Feb 2023 21:59:28 +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 31KLxOlF3801961; Mon, 20 Feb 2023 16:59:24 -0500 From: Tom Lane To: Alexander Lakhin cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17795: Erroneous parsing of floating-poing components in DecodeISO8601Interval() In-reply-to: <18486f0e-cdfa-49b3-c863-bb83bdd8a097@gmail.com> References: <17795-748d6db3ed95d313@postgresql.org> <3449142.1676850059@sss.pgh.pa.us> <18486f0e-cdfa-49b3-c863-bb83bdd8a097@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Mon, 20 Feb 2023 13:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3801959.1676930364.1@sss.pgh.pa.us> Date: Mon, 20 Feb 2023 16:59:24 -0500 Message-ID: <3801960.1676930364@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lakhin writes: > 20.02.2023 02:40, Tom Lane wrote: >> There are a couple of other places where datetime.c is using strtod() >> to parse what it expects to be a fractional value. I'm inclined to >> just barf if the result is out of range. Maybe we shouldn't back-patch >> that aspect into v15, not sure. > I could not find a way to pass the e-notation there. True, I was thinking of this as future-proofing not as closing any live loophole. > Also, the comment added makes me wonder, whether ".1e-10" > (e.g., in "1.1e-10") can be considered bogus too. I would say so > (if we are going to just add a fraction produced by ParseFraction() > to some integer part later, we still get the wrong result > (for the scientific notation)), and if we want to have > a consistent syntax, maybe it's worth to check an input string for 'e'/'E', > but if not, then maybe leave it alone. I would prefer the latter for now. Fair enough. I pushed the ParseISO8601Number fix without touching the other two places. regards, tom lane