Re: Bug in to_timestamp().

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alex Ignatov <a.ignatov@postgrespro.ru>, Bruce Momjian <bruce@momjian.us>, amul sul <sul_amul@yahoo.co.in>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-06-23T17:46:15Z
Lists: pgsql-hackers
On Thursday, June 23, 2016, Robert Haas <robertmhaas@gmail.com> wrote:

> On Thu, Jun 23, 2016 at 1:12 PM, David G. Johnston
> <david.g.johnston@gmail.com <javascript:;>> wrote:
> > to_timestamp with its present behavior is, IMO, a poorly designed
> function
> > that would never be accepted today.  Concrete proposals for either
> fixing or
> > deprecating (or both) are welcome.  Fixing it should not cause
> unnecessary
> > errors to be raised.
>
> Sheesh.  Who put you in charge of this?  You basically seem like you
> are trying to shut up anyone who supports this change, and I don't
> think that's right.


>
I'm all for a change in this area - though I'm not impacted enough to
actually work on a design proposal.  And I'm not sure how asking for ideas
constitutes trying to shut people up.  Especially since if no one does
float a proposal we'll simply have this discussion next year when someone
new discovers how badly behaved this function is.


>  My main point is that I'm inclined to deprecate it.
>

> I can almost guarantee that would make a lot of users very unhappy.
> This function is widely used.
>
>
Tell people not to use.  We'd leave it in, unchanged, on backward
compatibility grounds.  This seems like acceptable behavior for the
project.  Am I mistaken?


> > My second point is if you are going to use this badly designed function
> you
> > need to protect yourself.
>
> I agree that anyone using this function should test their format
> strings carefully.
>
> > My understanding is that is not going to change for 9.6.
>
> That's exactly what is under discussion here.
>
>
Ok.  I'm having trouble seeing this justified as a bug fix - the docs
clearly state our behavior is intentional.  Improved behavior, yes, but
that's a feature and we're in beta2.  Please be specific if you believe
I've misinterpreted project policies on this matter.

David J.

Commits

  1. Improve behavior of to_timestamp()/to_date() functions

  2. Implement TZH and TZM timestamp format patterns

  3. as attache of this mail is patch (to the main tree) with to_char's