Re: computing dT from an interval

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: "Michael J(dot) Baars" <mjbaars1977(dot)pgsql-hackers(at)cyberfiber(dot)eu>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: computing dT from an interval
Date: 2021-02-22 16:29:35
Message-ID: 3585649.1614011375@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:
> I'm not sure whether this is a bug or an infelicity we document, but
> at least in some parts of the world, this calculation doesn't comport
> with the calendar in place at the time:
> SELECT to_timestamp('1753', 'YYYY') - to_timestamp('1752', 'YYYY');

Yeah, Appendix B.6 mentions that.

What isn't documented, and maybe should be, is the weird results
you get from the tzdata info for years before standardized time
zones came into use.

regression=# show timezone;
TimeZone
------------------
America/New_York
(1 row)

regression=# select '2020-01-01 00:00'::timestamptz;
timestamptz
------------------------
2020-01-01 00:00:00-05
(1 row)

regression=# select '1800-01-01 00:00'::timestamptz;
timestamptz
------------------------------
1800-01-01 00:00:00-04:56:02
(1 row)

If you're wondering where the heck that came from, it corresponds
to the actual longitude of New York City, i.e. local mean solar time.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Muhammad Usama 2021-02-22 16:44:03 Re: [PATCH] Feature improvement for TRUNCATE tab completion.
Previous Message Jim Mlodgenski 2021-02-22 16:20:54 Parser Hook