can insert timestamp value that can't be read - Mailing list pgsql-bugs

From Jeff Davis
Subject can insert timestamp value that can't be read
Date
Msg-id 1399415471.27807.49.camel@sussancws0025
Whole thread Raw
Responses Re: can insert timestamp value that can't be read
List pgsql-bugs
Example:

  => create table r(t timestamp);
  CREATE TABLE
  => insert into r values(
         timestamp '294277-01-09 00:00:00' + interval '36 hour'
       );
  INSERT 0 1
  => select * from r;
  ERROR:  timestamp out of range

(A similar case with different values exists when compiled with
--disable-integer-datetimes.)

It looks like timestamp[tz]_pl_interval() is not doing proper validation
in all paths.

Patch attached. I looked for other areas that might be affected, but
none jumped out.

The patch does not introduce any tests because I couldn't think of a
good way to test both integer and float timestamps properly.

Regards,
    Jeff Davis


Attachment

pgsql-bugs by date:

Previous
From: Noah Misch
Date:
Subject: Re: regression failure on master with --disable-integer-datetimes
Next
From: Andres Freund
Date:
Subject: Re: BUG #9635: Wal sender process is using 100% CPU