Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2011-03-31 18:23:50
Subject: Re: SSI bug?
Previous:From: Dan PortsDate: 2011-03-31 18:12:16
Subject: Re: SSI bug?

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group