Обсуждение: Incorrect text to timestamp conversion

Поиск
Список
Период
Сортировка

Incorrect text to timestamp conversion

От
"Derrick Hamner"
Дата:
Your name            :    Derrick Hamner
Your email address    :    derrickh@ntiusa.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :    AMD Athlon

  Operating System (example: Linux 2.0.26 ELF)     :    Linux 2.4.9

  PostgreSQL version (example: PostgreSQL-7.1.3):   PostgreSQL-7.1.3,
PostgresSQL-7.1.2

  Compiler used (example:  gcc 2.95.2)        :    postgresql-7.1.3-2.i386.rpm from
Red Hat 7.2, postgresql-7.1.2-4PGDG


Please enter a FULL description of your problem:
------------------------------------------------
I believe that I have found a rounding error in the conversion of the text
type returned by timeofday() to timestamp and to timestamp with time zone.


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
test=# select 'Mon Nov 12 04:28:59.995001 2001 PDT'::timestamp;
         ?column?
---------------------------
 2001-11-12 03:28:60.00-08
(1 row)

Note the seconds field in the result is 60. This behavior occurs when the
seconds field is 59 and with any fractional second value from 0.995001
through 0.999999. The rest of the string does not seem to influence this
behavior.