On 03/31/2011 10:51 AM, Brendan Jurd wrote:
>
> I agree with your summary of the ISO standards. Unfortunately,
> to_date and its cohorts are not targeting ISO. They are targeting
> quasi-compatibility with some Oracle functions of the same name, I
> suppose to make life easier for folks who are migrating from Oracle to
> Postgres. Any proposed reform of these (admittedly weird and kludgy)
> functions is viewed through that lens, and usually rejected on those
> grounds. I've been down that road before. There's not much point
> having compatibility functions if they aren't, well, compatible.
>
> In the big picture, to_date isn't meant to be the general entry point
> for parsing dates. If you wanted to make ISO8601 work as a syntax for
> inputting date type literals vis. SELECT date '2011-W14-01', you might
> have a better shot at getting that off the ground.
>
Well, to return to the original issue, should we allow the day to be
spelled out and fix it (as noted in this thread it is non-standard but
also unambiguous and we already allow plenty of non-standard formats) or
throw an error? For me personally, either would be fine. What isn't
correct is the current behavior:
select to_date('2011-13-SUN', 'IYYY-IW-DY');
to_date
------------
2011-03-28
Cheers,
Steve