| From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | can insert timestamp value that can't be read |
| Date: | 2014-05-06 22:31:11 |
| Message-ID: | 1399415471.27807.49.camel@sussancws0025 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| timestamp_validation.patch | text/x-patch | 3.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2014-05-06 22:41:39 | Re: BUG #9635: Wal sender process is using 100% CPU |
| Previous Message | Noah Misch | 2014-05-06 19:39:52 | Re: regression failure on master with --disable-integer-datetimes |