public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Joseph Koshakow <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Date-Time dangling unit fix
Date: Sat, 04 Mar 2023 16:05:33 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAAvxfHdRsz=KRbp=gFvbOzVfcX1UoDxCzj8BwAYKMt46Hi+eAw@mail.gmail.com>
References: <CAAvxfHf2Q1gKLiHGnuPOiyf0ASvKUM4BnMfsXuwgtYEb_Gx0Zw@mail.gmail.com>
<CAAvxfHf++UNBoYua8AQkwM3MCpLszOBeug-2F9PjD79mrW5SDA@mail.gmail.com>
<CAAvxfHc8xy42wX8Xk7RTLee_O16ui4RfT7vkjfnN+ERgpaHV+g@mail.gmail.com>
<CAAvxfHdRsz=KRbp=gFvbOzVfcX1UoDxCzj8BwAYKMt46Hi+eAw@mail.gmail.com>
Joseph Koshakow <[email protected]> writes:
> On Mon, Dec 12, 2022 at 10:55 AM Joseph Koshakow <[email protected]> wrote:
>> I just found another class of this bug that the submitted patch does
>> not fix. If the units are at the beginning of the string, then they are
>> also ignored. For example, `date 'm d y2020m11d3'` is also valid. I
>> think the fix here is to check and make sure that ptype is 0 before
>> reassigning the value to a non-zero number. I'll send an updated patch
>> with this tonight.
> Attached is the described patch.
I started to look at this, and soon noticed that while we have test cases
matching this sort of date input, there is no documentation for it. The
code claims it's an "ISO" (presumably ISO 8601) format, and maybe it is
because it looks a lot like the ISO 8601 format for intervals (durations).
But I don't have a copy of ISO 8601, and some googling fails to find any
indication that anybody else believes this is a valid datetime format.
Wikipedia for example documents a lot of variants of ISO 8601 [1],
but nothing that looks like this.
I wonder if we should just rip this code out instead of fixing it.
I suspect its real-world usage is not different from zero. We'd
have to keep the "Jnnn" Julian-date case, though, so maybe there's
little to be saved.
If we do keep it, there's documentation work to be done. But the
first bit of doco I'd want to see is a pointer to a standard.
regards, tom lane
[1] https://en.wikipedia.org/wiki/ISO_8601
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Date-Time dangling unit fix
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox