Timestamp bug WAS: Problem with restore on upgrading to 7.1

Поиск
Список
Период
Сортировка
От Joseph Shraibman
Тема Timestamp bug WAS: Problem with restore on upgrading to 7.1
Дата
Msg-id 3AEF6723.8E0CDE0@selectacast.net
обсуждение исходный текст
Ответ на Problem with restore on upgrading to 7.1  (Joseph Shraibman <jks@selectacast.net>)
Список 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@selectacast.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@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com

В списке pgsql-general по дате отправления:

Предыдущее
От: "Thomas F. O'Connell"
Дата:
Сообщение: do views cache functions? (was Re: do functions cache views?)
Следующее
От: Peter Pilsl
Дата:
Сообщение: readline-support