Re: Rectifying wrong Date outputs - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Rectifying wrong Date outputs
Date
Msg-id AANLkTimqoujQm+9cYtiw6Lvzee9QtzqkUcBSpxmgF1HG@mail.gmail.com
Whole thread Raw
In response to Re: Rectifying wrong Date outputs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Rectifying wrong Date outputs
List pgsql-hackers
On Mon, Mar 21, 2011 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Mon, Mar 21, 2011 at 10:18 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> As far as I can see, that would completely destroy the use-case of
>>> trying to parse a string where there's not non-digit delimiters and
>>> so you have to take exactly the specified number of digits, not more.
>
>> Yeah, I thought about that, but it seems that use case is already
>> hopelessly broken in both PostgreSQL and Oracle, so I'm disinclined to
>> worry about it.
>
> How so?
>
> regression=# select to_date('20110321', 'YYYYMMDD');
>  to_date
> ------------
>  2011-03-21
> (1 row)
>
> regression=# select to_date('110321', 'YYMMDD');
>  to_date
> ------------
>  2011-03-21
> (1 row)
>
> If you break the latter case, I am sure the villagers will be on your
> doorstep shortly.

Oh, dear.  No wonder this code is so hard to get right.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: 2nd Level Buffer Cache
Next
From: Gurjeet Singh
Date:
Subject: Missing semicolon in parser's gram.y