datetime questions and fix to dt.c

From: t-ishii(at)sra(dot)co(dot)jp (Tatsuo Ishii)
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: datetime questions and fix to dt.c
Date: 1998-09-23 07:54:38
Message-ID: 199809230756.QAA16775@meshsv26.tk.mesh.ad.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Keith Parks 1998-09-23 10:01:47 pg_dump, problem with user defined types?
Previous Message Michael Meskes 1998-09-23 07:12:19 Problem on TODO list