Timestamp bug WAS: Problem with restore on upgrading to 7.1

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Timestamp bug WAS: Problem with restore on upgrading to 7.1
Date: 2001-05-02 01:47:15
Message-ID: 3AEF6723.8E0CDE0@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

owl=# select '2001-05-01 20:57:59.999-04'::timestamp;
?column?
---------------------------
2001-05-01 20:57:60.00-04
(1 row)

owl=# select version();
version
-------------------------------------------------------------------
PostgreSQL 7.1 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1 row)

So it appears this is a bug in 7.1 as well. The problem is in
postgresql-7.1/src/backend/utils/adt/datetime.c line 2099:
sprintf((str + 17), ((fsec != 0) ? "%05.2f" : "%02.0f"), sec);

..which just tells sprintf to round the seconds. Line 2137 should also
be fixed.

When this is fixed the fix should be backported to 7.0.x so people can
dump for upgrading to 7.1.x.

Tom Lane wrote:
>
> Joseph Shraibman <jks(at)selectacast(dot)net> writes:
> > psql:dumpall-2001-4-27:8452: ERROR: copy: line 8933, Bad timestamp
> > external representation '2001-01-17 19:37:60.00-05'
>
> Are you on Mandrake by any chance? Looks like your 7.0 installation
> had that infamous roundoff problem.
>
> I recommend manually changing "37:60" to "38:00" in the dump file,
> then you should be able to load it.
>
> regards, tom lane

--
Joseph Shraibman
jks(at)selectacast(dot)net
Increase signal to noise ratio. http://www.targabot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harry Yau 2001-05-02 02:10:36 Re: Re: function with multi-values
Previous Message Thomas F. O'Connell 2001-05-01 23:05:41 do views cache functions? (was Re: do functions cache views?)