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/