Thread: datetime bug in 6.6.0

datetime bug in 6.6.0

From
George Young
Date:
Your name        :    george young
Your email address    :    gry@ll.mit.edu


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :pentium(quad xeon actually)

  Operating System (example: Linux 2.0.26 ELF)     :linux  2.2.11 (SuSE 6.1)

  PostgreSQL version (example: PostgreSQL-6.5.1):PostgreSQL-6.6

  Compiler used (example:  gcc 2.8.0)        : gcc version 2.95.1 19990816 (release)


Please enter a FULL description of your problem:
------------------------------------------------
If a datetime value is inserted with zero seconds, it is displayed
with '60' seconds, and minutes just as entered.  Aside from being incorrect
on it's face, this prevents dumping and restoring, since a seconds value of 60
is invalid for input.

The problem happens with iso style dates as well as the default, shown below.



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
psql pig2a
[PostgreSQL 6.6.0 on i686-pc-linux-gnu, compiled by gcc 2.95.1]
pig2a=> create table foo(d datetime);
CREATE
pig2a=> insert into foo values('1999-jan-23 8:02:00');
INSERT 237044 1
pig2a=> select * from foo;
d
-------------------------------
Sat Jan 23 08:02:60.00 1999 EST
(1 row)

select datetime_part('millisecond',d) from foo;
datetime_part
-------------
         1000
(1 row)

pig2a=> insert into foo values('1999-jan-23 8:02:60');
ERROR:  Bad datetime external representation '1999-jan-23 8:02:60'

pig2a=> show datestyle;
NOTICE:  DateStyle is Postgres with US (NonEuropean) conventions





If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
Sorry...