pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8216: TO_DATE does not support th format provided
2+ messages / 2 participants
[nested] [flat]

* BUG #8216: TO_DATE does not support th format provided
@ 2013-06-07 02:50  sunitha.mudumba@blss.com.au
  0 siblings, 1 reply; 2+ messages in thread

From: sunitha.mudumba@blss.com.au @ 2013-06-07 02:50 UTC (permalink / raw)
  To: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #8216: TO_DATE does not support th format provided
@ 2013-06-07 13:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: sunitha.mudumba@blss.com.au
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2013-06-07 13:41 UTC (permalink / raw)
  To: sunitha.mudumba@blss.com.au; +Cc: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-06-07 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07 02:50 BUG #8216: TO_DATE does not support th format provided sunitha.mudumba@blss.com.au
2013-06-07 13:41 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox