Re: [HACKERS] datetime questions and fix to dt.c - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] datetime questions and fix to dt.c
Date
Msg-id 199809231752.NAA02909@candle.pha.pa.us
Whole thread Raw
In response to datetime questions and fix to dt.c  (t-ishii@sra.co.jp (Tatsuo Ishii))
List 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@sra.co.jp



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


--
  Bruce Momjian                        |  maillist@candle.pha.pa.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.        |

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Problem on TODO list
Next
From: Michael Meskes
Date:
Subject: Re: [HACKERS] Problem on TODO list