Re: Bug in to_timestamp().

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>, Bruce Momjian <bruce(at)momjian(dot)us>, amul sul <sul_amul(at)yahoo(dot)co(dot)in>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in to_timestamp().
Date: 2016-06-23 18:52:52
Message-ID: b1149177-9ef8-1138-57cd-bd0eedd4494f@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/23/16 12:29 PM, Alvaro Herrera wrote:
> David G. Johnston wrote:
>> On Thursday, June 23, 2016, Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> wrote:
>>
>>> Arguing just like that one can say that we don't even need exception like
>>> "division by zero". Just use well-formed numbers in denominator...
>>> Input data sometimes can be generated automagically. Without exception
>>> throwing debugging stored function containing to_timestamp can be painful.
>>
>> to_timestamp with its present behavior is, IMO, a poorly designed function
>> that would never be accepted today.
>
> I'm not sure about that.
>
> to_timestamp was added to improve compatibility with Oracle, by commit
> b866d2e2d794. I suppose the spec should follow what's documented here,
>
> http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions193.htm
> http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34924
>
> and that wherever we deviate from that, is a bug that should be fixed.

+1

I'm also in favor of a parsing function that actually follows the format
specifier, but not enough to write a patch.

One thing that I think could happen for 9.6 is documenting how you could
get the desired results with one of the regex functions. Not the nicest
way to handle this problem, but it is workable and having a regex
example available for people to start with would be very helpful.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-06-23 18:56:22 Re: Bug in to_timestamp().
Previous Message Tom Lane 2016-06-23 18:02:37 Re: Bug in to_timestamp().