Re: Bug in to_timestamp(). - Mailing list pgsql-hackers

From Artur Zakirov
Subject Re: Bug in to_timestamp().
Date
Msg-id 22dbe4e0-b550-ca86-8634-adcda0faa159@postgrespro.ru
Whole thread Raw
In response to Re: Bug in to_timestamp().  (Artur Zakirov <a.zakirov@postgrespro.ru>)
Responses Re: Bug in to_timestamp().  (amul sul <sul_amul@yahoo.co.in>)
Re: Bug in to_timestamp().  (Artur Zakirov <a.zakirov@postgrespro.ru>)
List pgsql-hackers
Hi,

> #1.
> Whitespace @ line # 317.

Sorry, fixed.

> #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?

--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Attachment

pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: Logical Replication WIP
Next
From: amul sul
Date:
Subject: Re: Bug in to_timestamp().