From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17795: Erroneous parsing of floating-poing components in DecodeISO8601Interval() |
Date: | 2023-02-20 10:00:00 |
Message-ID: | 18486f0e-cdfa-49b3-c863-bb83bdd8a097@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
20.02.2023 02:40, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>> I've encountered a pair of relatively new anomalies when using ISO-8601
>> intervals.
>>
>>
>> On the whole I think the right fix is to go back to using strtod()
>> to parse the whole input string, as we did before e39f99046. This
>> results in some inaccuracy if there's more than 15 digits in the
>> input, but I don't care enough about that scenario to work harder.
This approach seems less fragile to me. All my examples shown before
work as expected now.
Thanks!
>> 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.
Looking at the callers of the ParseFraction() and DecodeNumberField()
I see only DecodeDate(), DecodeDateTime(), DecodeTimeOnly(),
and DecodeInterval(). All these functions pass to ParseFraction()
and DecodeNumberField() not full "fractional" strings, but fields, that
were extracted before. For example, with "SELECT time 'J0.5e1';"
there are three fields "j", "0.5", "e1" passed to DecodeTimeOnly(),
or with "SELECT interval '1.5e1';" I see fields "1.5" and "e1".
(Maybe I miss something.)
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.
Best regards,
Alexander
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2023-02-20 12:46:30 | BUG #17802: PGLogical getting Terminated |
Previous Message | Michael Paquier | 2023-02-20 07:59:25 | Re: BUG #17789: process_pgfdw_appname() fails for autovacuum workers |