Re: [HACKERS] datetime questions and fix to dt.c

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: t-ishii(at)sra(dot)co(dot)jp
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] datetime questions and fix to dt.c
Date: 1998-09-23 17:52:44
Message-ID: 199809231752.NAA02909@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Applied.

---------------------------------------------------------------------------

Documents stat that datetime type allows "far into future."
So I did some testing.

test=> select datetime '3276900-12-01';
?column?
--------------------------
Tue Aug 27 00:00:00 337095
(1 row)

test=> select '32769000-12-01'::datetime;
?column?
--------------------------
Thu Jan 07 00:00:00 431143
(1 row)

test=> select '327690000-12-01'::datetime;
?column?
---------------------------
Sat Aug 27 00:00:00 1371616
(1 row)

I suspect this is due to the limitation of the timezone database
in my system. Is that correct? If so, how can I know how far we
can go into the future using the datetime type?

BTW, dt.c seems to have problem with date_part() function.

test=> select date_part('microsecond','1998/9/23 12:04:05.1234'::datetime);
date_part
---------
123.4
(1 row)

test=> select date_part('millisecond','1998/9/23 12:04:05.1234'::datetime);
date_part
---------
123.4

Included patches should fix this.

*** dt.c.orig Wed Sep 23 16:03:44 1998
--- dt.c Wed Sep 23 16:06:10 1998
***************
*** 2199,2205 ****
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid
* time */
{"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */
! {"microsecon", UNITS, DTK_MILLISEC}, /* "microsecond" relative
* time units */
{"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
{"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
--- 2199,2205 ----
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid
* time */
{"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */
! {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative
* time units */
{"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
{"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
--
Tatsuo Ishii
t-ishii(at)sra(dot)co(dot)jp

[Charset iso-2022-jp unsupported, skipping...]

--
Bruce Momjian | maillist(at)candle(dot)pha(dot)pa(dot)us
830 Blythe Avenue | http://www.op.net/~candle
Drexel Hill, Pennsylvania 19026 | (610) 353-9879(w)
+ If your life is a hard drive, | (610) 853-3000(h)
+ Christ can be your backup. |

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1998-09-23 18:20:10 Re: [HACKERS] Problem on TODO list
Previous Message Bruce Momjian 1998-09-23 17:48:50 Re: [HACKERS] Problem on TODO list