Re: [PATH] Correct negative/zero year in to_date/to_timestamp

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATH] Correct negative/zero year in to_date/to_timestamp
Date: 2016-03-11 13:40:20
Message-ID: CA+TgmoZGZZ1+swjEmG42ZrABA6LpZu2ZVKG1=MV-4qX6YYFQ5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 28, 2016 at 9:38 PM, Vitaly Burovoy
<vitaly(dot)burovoy(at)gmail(dot)com> wrote:
>> However, I'm not sure we ought to tinker with the behavior in this
>> area. If YYYY-MM-DD is going to accept things that are not of the
>> format YYYY-MM-DD, and I'd argue that -1-06-01 is not in that format,
>
> It is not about format, it is about values.

I disagree. In a format like "-1-06-01", you want the first minus to
indicate negation and the other two to be a separator. That's not
very far away from wanting the database to read your mind.

> Because it is inconvenient a little. If one value ("-2345") is passed,
> another one ("2346 BC") is got. In the other case a programmer must
> check for negative value, and if so change a sign and add "BC" to the
> format. Moreover the programmer must keep in mind that it is not
> enough to have usual date format "DD/MM/YYYY", because sometimes there
> can be "BC" part.

Yeah, well, that's life. You can write an alternative function to
construct dates that works the way you like, and that may well be a
good idea. But I think *this* change is not a good idea, and
accordingly I vote we reject this patch.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2016-03-11 13:44:02 Re: dblink: add polymorphic functions.
Previous Message Robert Haas 2016-03-11 13:35:21 Re: snapshot too old, configured by time