public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: David Rowley <[email protected]>
Cc: Richards, Nina <[email protected]>
Cc: Watzinger, Alexander <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Support for dates before 4713 BC
Date: Wed, 16 Oct 2024 20:36:12 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAApHDvomL7e49Y0ZyCu4ZrSq-mF7bcnq6cz+8_BwvNM4bL+Ruw@mail.gmail.com>
References: <[email protected]>
<CAApHDvomL7e49Y0ZyCu4ZrSq-mF7bcnq6cz+8_BwvNM4bL+Ruw@mail.gmail.com>
David Rowley <[email protected]> writes:
> It's by no means a trivial thing to do, but it is possible to
> implement new types in PostgreSQL [1]. If you invented your own type,
> you could significantly widen the upper and lower bounds when compared
> with the standard date type.
However, you'd then have to reimplement some large fraction of the
existing datetime support to have something useful.
We're already inventing freely to use the Gregorian calendar for
millenia before Pope Gregory lived, so I see no conceptual argument
not to extend that back even further.
IIRC the stumbling block for not going back past Julian day 0 was
uncertainty about whether the date2j and j2date algorithms behave
correctly for negative Julian dates --- which at the time was
compounded by the fact that C90 was vague about the rounding direction
for integer division with negative inputs. Now that we assume C99
with its well-defined rule for that, at least some of the uncertainty
is gone. Somebody would still have to study that code and either
prove that it's OK or correct it. And then there would be a
nontrivial amount of effort to work outwards and fix anything else
that is assuming that limitation. So it would take somebody with
considerable motivation to make it happen, but if such a somebody were
to appear with a patch, we'd likely take it. (To be clear, I doubt
any of the principal current hackers are interested in doing this.)
Now, this would still only get you to a lower-bound date somewhere
around 300000 BC. If you need to deal with geological or astronomical
time spans, then yeah you need a new type --- but presumably you would
not feel a need to tie it to Gregorian calendar dates, so the need to
reimplement a ton of related logic would not be there.
regards, tom lane
view thread (3+ 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], [email protected], [email protected]
Subject: Re: Support for dates before 4713 BC
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