Re: documentation bug?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: PostgreSQL hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: documentation bug?
Date: 2004-01-05 20:48:26
Message-ID: 1073335705.25138.1372.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2004-01-05 at 10:02, Tatsuo Ishii wrote:
> I see following in the doc:
>
> Table 9-21. Template Patterns for Date/Time Formatting
> :
> :
> J Julian Day (days since January 1, 4712 BC)
>
> I think 4712 should be 4713.

template1=# select to_char('1 Jan 4713BC'::date,'J');
to_char
---------
38
(1 row)

template1=# select to_char('24 Nov 4714BC'::date,'J');
to_char
---------
0
(1 row)

I think that 1 Jan 4713BC is by the Julian calendar, whereas SQL dates
are defined to be by the Gregorian calendar (even before it existed).
Those 38 days are presumably the difference between the two calendar
systems at that date.

Here's a little bug:
template1=# select to_char('24 Nov 0001'::date,'J');
to_char
---------
1721753
(1 row)

template1=# select to_char('24 Nov 0000'::date,'J');
to_char
---------
1721388
(1 row)

There is no year 0, so this ought to give an error. It may explain why
we go back to 4713BC instead of 4712BC.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And thou shalt love the LORD thy God with all thine
heart, and with all thy soul, and with all thy might."
Deuteronomy 6:5

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-01-05 21:06:20 remove 'noversion' from standalone backend
Previous Message ivan 2004-01-05 20:42:31 Re: time format