Thread: 'Bad timestamp external representation' error when restoring database

'Bad timestamp external representation' error when restoring database

From
Søren Neigaard
Date:
I have made a 'pg_dump database_name > dump_file' from a 7.1 database, and
then I tried a 'psql database_name < dump_file' on a empty 7.1 database. But
this gives me the following error:

--------- error ----------
You are now connected as new user postgres.
ERROR:  ProcedureCreate: procedure plpgsql_call_handler already exists with
same arguments
ERROR:  Language plpgsql already exists
You are now connected as new user dba.
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
CREATE
ERROR:  copy: line 3580, Bad timestamp external representation '2002-08-23
08:31:60.00+02'
PQendcopy: resetting connection
--------- error ----------

Why do I get this error when I made the dump from a 7.1 to a 7.1, is that
not a bit strange? What can I do to work around this?

Med venlig hilsen/Best regards
Søren Neigaard
System Architect
................................
Mobilethink A/S
Arosgaarden
Åboulevarden 23, 5.sal
DK - 8000 Århus C
Telefon: +45 86207800
Direct: +45 86207810
Fax: +45 86207801
Email: s.neigaard@mobilethink.dk
Web: www.mobilethink.dk
................................


Re: 'Bad timestamp external representation' error when restoring database

From
Tom Lane
Date:
=?iso-8859-1?Q?S=F8ren_Neigaard?= <s.neigaard@mobilethink.dk> writes:
> ERROR:  copy: line 3580, Bad timestamp external representation '2002-08-23
> 08:31:60.00+02'
> PQendcopy: resetting connection

This is a known bug in older PG releases: sometimes a time like
"08:31:59.999" is mistakenly rounded off as "08:31:60.00" which of course
the timestamp reader code thinks is bogus.  I'm afraid you have little
choice but to edit the dump file to fix the broken timestamps (a sed
script might help here).

You should think about updating to a more recent release ---
AFAIK this problem is fixed in 7.2.

            regards, tom lane