Re: BUG #1630: Wrong conversion in to_date() function. See example.

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #1630: Wrong conversion in to_date() function. See example.
Дата
Msg-id 20050427142207.GA47188@winnie.fuhr.org
обсуждение исходный текст
Ответ на BUG #1630: Wrong conversion in to_date() function. See example.  ("Ariel E. Carná/Elizabeth Sosa" <acarna@tarifar.com>)
Ответы Re: BUG #1630: Wrong conversion in to_date() function. See example.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Tue, Apr 26, 2005 at 11:48:12PM +0100, Ariel E. Carná/Elizabeth Sosa wrote:
>
> Case PgSQL 7.3.8/SuSE Linux 8.2 (i586)
> ======================================
> PROD=# select to_date('2005-02-32', 'YYYY-MM-DD');
>   to_date
> ------------
>  2005-03-04
> (1 row)
>
> Case PgSQL 7.4.6/SuSE Linux 9.2
> (i586)======================================
> PROD=> select to_date('2005-02-32', 'YYYY-MM-DD');
>   to_date
> ------------
>  04-03-2005
> (1 row)

What bug are you reporting?  These are the same date displayed in
different formats -- are you familiar with the DateStyle setting?

http://www.postgresql.org/docs/7.3/interactive/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT
http://www.postgresql.org/docs/7.4/interactive/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT

test=> SELECT version();
                                  version
---------------------------------------------------------------------------
 PostgreSQL 7.4.7 on sparc-sun-solaris2.9, compiled by GCC gcc (GCC) 3.4.2
(1 row)

test=> SET DateStyle TO 'ISO,MDY';
SET
test=> SELECT to_date('2005-02-32', 'YYYY-MM-DD');
  to_date
------------
 2005-03-04
(1 row)

test=> SET DateStyle TO 'Postgres,DMY';
SET
test=> SELECT to_date('2005-02-32', 'YYYY-MM-DD');
  to_date
------------
 04-03-2005
(1 row)

If anything I'd expect 2005-02-32 to be rejected as invalid, but I
don't know the history or rationale behind to_date's behavior.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: BUG #1632: Several jailed PostgreSQL instances.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1630: Wrong conversion in to_date() function. See example.