BUG #8216: TO_DATE does not support th format provided
The following bug has been logged on the website:
Bug reference: 8216
Logged by: Sunitha Mudumba
Email address: sunitha.mudumba@blss.com.au
PostgreSQL version: 9.2.4
Operating system: Windows
Description:
To_date does not throw an error when an invalid date is provided to it
select to_date('10-30-2012','dd-MM-YYYY');
It is not forcing the format on the date, instead it stores 2014-06-14.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
sunitha.mudumba@blss.com.au writes:
To_date does not throw an error when an invalid date is provided to it
select to_date('10-30-2012','dd-MM-YYYY');
That's not a bug; it's operating as designed. If you want more error
checking, don't use to_date() --- just cast the string to date.
regression=# show datestyle;
DateStyle
-----------
ISO, MDY
(1 row)
regression=# select '10-30-2012'::date;
date
------------
2012-10-30
(1 row)
regression=# set datestyle = dmy;
SET
regression=# select '10-30-2012'::date;
ERROR: date/time field value out of range: "10-30-2012"
LINE 1: select '10-30-2012'::date;
^
HINT: Perhaps you need a different "datestyle" setting.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs