Re: 7.2 and current timestamp bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org, Thomas Lockhart <lockhart(at)fourpalms(dot)org>
Subject: Re: 7.2 and current timestamp bug?
Date: 2002-02-16 19:03:43
Message-ID: 20702.1013886223@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> Shouldn't timestamp_in detect the invalid timestamp value when it is
> inserted?

Yeah. A simpler test case is

regression=# select '2465001-01-01 00:00:00'::timestamp;
ERROR: Unable to format timestamp with time zone; internal coding error

IMHO the IS_VALID_JULIAN() macro ought to test for out-of-range in the
forward direction as well as rearward. The immediate problem in this
example is that date2j() overflows --- silently --- producing a negative
result which later confuses timestamp2tm. We could limit the allowed
range of Julian dates to prevent that.

Another possibility is to allow date2j and j2date to pass/return double
instead of int, but that is a larger change and probably not very safe
to apply for 7.2.1.

Thomas, your thoughts?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2002-02-16 20:20:28 Re: Odd statistics behaviour in 7.2
Previous Message Tom Lane 2002-02-16 17:57:19 Re: Odd statistics behaviour in 7.2