Re: 7.2 and current timestamp bug? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 7.2 and current timestamp bug?
Date
Msg-id 20702.1013886223@sss.pgh.pa.us
Whole thread Raw
In response to 7.2 and current timestamp bug?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Odd statistics behaviour in 7.2
Next
From: Bruno Wolff III
Date:
Subject: Re: Odd statistics behaviour in 7.2