Re: Rectifying wrong Date outputs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Piyush Newe <piyush(dot)newe(at)enterprisedb(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rectifying wrong Date outputs
Date: 2011-03-21 16:39:24
Message-ID: 2701.1300725564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Mar 21, 2011 at 10:18 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2011-03-21 16:47:21 Re: 2nd Level Buffer Cache
Previous Message Yeb Havinga 2011-03-21 16:29:38 Re: Sync Rep and shutdown Re: Sync Rep v19