BUG #1180: incorrect date handling - Mailing list pgsql-bugs

From PostgreSQL Bugs List
Subject BUG #1180: incorrect date handling
Date
Msg-id 20040623023249.EB659CF499C@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1180: incorrect date handling
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1180
Logged by:          Ben Bidner

Email address:      vort@wiretapped.net

PostgreSQL version: 7.3.2

Operating system:   linux 2.4.20

Description:        incorrect date handling

Details:

colony=# CREATE TABLE foo (dtime TIMESTAMP);
CREATE TABLE
colony=# insert into foo values ('2003-12-11 23:59:60.00');
ERROR:  Bad timestamp external representation '2003-12-11 23:59:60.00'
colony=# insert into foo values ('2003-12-11 23:59:59.999999');
INSERT 97940618 1
colony=# select * from foo;
 dtime
----------------------------
 2003-12-11 23:59:59.999999
(1 row)

^-- correct

colony=# insert into foo values ('2003-12-11 23:59:59.9999999');
INSERT 97940623 1
colony=# select * from foo;
 dtime
----------------------------
 2003-12-11 23:59:59.999999
 2003-12-11 23:59:60.00
(1 row)

^-- incorrect

2003-12-11 23:59:60.00 should equal 2003-12-12 00:00:00

under 7.4.2, (had a friend test it out) inserting a timestamp with a time of
23:59:60.00 is allowed, it just increments the day and sets the time to
00:00:00 (as one would expect). However it still allows you to insert the
time as `23:59:59.9999999` and it updates the time (incorrectly) to
`23:59:60.00` instead of incrementing the day and setting the time to
00:00:00 (since 23:59:60 is .. or should be invalid).

vort@wiretapped.net

pgsql-bugs by date:

Previous
From: Kris Jurka
Date:
Subject: Re: BUG #1177: JDBC driver doesn't handle all dates correctly
Next
From: Tom Lane
Date:
Subject: Re: BUG #1180: incorrect date handling