Re: Bug in to_timestamp().

amulsul <sul_amul@yahoo.co.in>

From: amul sul <sul_amul@yahoo.co.in>
To: Artur Zakirov <a.zakirov@postgrespro.ru>, Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, "David G. Johnston" <david.g.johnston@gmail.com>, Alex Ignatov <a.ignatov@postgrespro.ru>, Bruce Momjian <bruce@momjian.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-08-25T09:10:29Z
Lists: pgsql-hackers
On Thursday, August 25, 2016 1:56 PM, Artur Zakirov <a.zakirov@postgrespro.ru> wrote:
>> #2. Warning at compilation;
>>
>> formatting.c: In function ‘do_to_timestamp’:
>> formatting.c:3049:37: warning: ‘prev_type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>> if (prev_type == NODE_TYPE_SPACE || prev_type == NODE_TYPE_SEPARATOR)
>> ^
>> formatting.c:2988:5: note: ‘prev_type’ was declared here
>> prev_type;
>> ^
>>
>> You can avoid this by assigning  zero (or introduce NODE_TYPE_INVAL ) to prev_type at following line:
>>
>> 256 +               prev_type;
>
>
>You are right. I assigned to prev_type NODE_TYPE_SPACE to be able to 
>execute such query:
>
>
>SELECT to_timestamp('---2000----JUN', 'YYYY MON');
>
>
>Will be it a proper behaviour?


Looks good to me, no one will complain if something working on PG but not on Oracle. 


Thanks & Regards,
Amul Sul


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