Re: BUG #11883: Year 1500 not treated as leap year when it was a leap year

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, hunsakerbn(at)familysearch(dot)org, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #11883: Year 1500 not treated as leap year when it was a leap year
Date: 2014-11-05 18:13:21
Message-ID: 15535.1415211201@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Wed, Nov 5, 2014 at 7:02 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>> Because 1500 % 100 == 0, I think 1500 was not a leap year.

> I believe it was a leap year in the Julian calendar, maybe that's
> where the difference comes from?

Indeed. We won't be changing our code though, because we document that
we follow Gregorian calendar rules even before that calendar was instituted
(ie, proleptic Gregorian calendar). You could argue for doing that
differently, but then what are you going to do for dates before the Julian
calendar was instituted? In any case, this behavior appears to be
required by the SQL standard, which repeatedly says that datetime values
are "constrained according to the Gregorian calendar".

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message nickbarnes01 2014-11-05 22:50:25 BUG #11884: pg_dump / restore mangles IS DISTINCT FROM expressions
Previous Message Tomas Vondra 2014-11-05 18:13:12 Re: BUG #11883: Year 1500 not treated as leap year when it was a leap year