Date conversion using day of week

Marc Munro <marc@bloodnok.com>

From: Marc Munro <marc@bloodnok.com>
To: pgsql-general@postgresql.org
Date: 2011-03-29T15:07:48Z
Lists: pgsql-hackers
I'm trying to validate a day of the week, and thought that to_date would
do the job for me.  But I found a case where it cannot tell the
difference between sunday and monday.  Is this a bug or intended
behaviour?

dev=# select to_date('2011-13-Mon', 'YYYY-IW-DY');
  to_date   
------------
 2011-03-28
(1 row)

dev=# select to_date('2011-13-Sun', 'YYYY-IW-DY');
  to_date   
------------
 2011-03-28
(1 row)

dev=# select to_date('2011-13-Tue', 'YYYY-IW-DY');
  to_date   
------------
 2011-03-29
(1 row)

This is on postgres 8.3.14.

__
Marc