On Mon, Feb 22, 2021 at 10:52:42AM -0500, Tom Lane wrote:
> "Michael J. Baars" <mjbaars1977.pgsql-hack...@cyberfiber.eu> writes:
> > So how do you compute the number of seconds in 8 years?
> 
> IMO, that's a meaningless computation, because the answer is not fixed.
> Before you claim otherwise, think about the every-four-hundred-years
> leap year exception in the Gregorian rules.  Besides, what if the
> question is "how many seconds in 7 years"?  Then it definitely varies
> depending on the number of leap days included.
> 
> What does make sense is timestamp subtraction, where the actual
> endpoints of the interval are known.

True.

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');
 ?column? 
══════════
 366 days
(1 row)

I'd like to imagine nobody will ever go mucking with the calendar to
the extent the British did that year, but one never knows.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


Reply via email to