Re: [HACKERS] Date conversion using day of week

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, marc(at)bloodnok(dot)com, hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Date conversion using day of week
Date: 2011-03-31 18:16:44
Message-ID: 4D94C50C.6070202@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2011-03-31 18:26:03 Access to NEW.column outside of a trigger function.
Previous Message Arjen Nienhuis 2011-03-31 18:06:48 Re: 7.4 quoting

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-03-31 18:23:50 Re: SSI bug?
Previous Message Dan Ports 2011-03-31 18:12:16 Re: SSI bug?