Re: [HACKERS] Bug in to_timestamp().
Artur Zakirov <a.zakirov@postgrespro.ru>
From: Arthur Zakirov <a.zakirov@postgrespro.ru>
To: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Dmitry Dolgov <9erthalion6@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Thomas Munro <thomas.munro@enterprisedb.com>, amul sul <sulamul@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, Alex Ignatov <a.ignatov@postgrespro.ru>, Bruce Momjian <bruce@momjian.us>, amul sul <sul_amul@yahoo.co.in>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-08-02T19:38:34Z
Lists: pgsql-hackers
On Thu, Aug 02, 2018 at 06:17:01PM +0300, Alexander Korotkov wrote:
> So, if number of spaces/separators between fields in input string is
> more than in format string and list space/separator skipped is minus
> sign, then it decides to glue that minus sign to TZH. I think this
> behavior is nice to follow, because it allows us to skip spaces after
> fields.
Good approach! With this change the following queries work now:
=# SELECT to_timestamp('2000 + JUN', 'YYYY MON');
=# SELECT to_timestamp('2000 + JUN', 'YYYY MON');
I think it is worth to add them to regression tests.
> 4) Spaces and separators in format string seem to be handled in the
> same way in non-FX mode. But strange things happen when you mix
> spaces and separators there.
> ...
> 1+2+3 are implemented in the attached patch, but not 4. I think that
> it's only worth to follow Oracle when it does reasonable things.
I agree with you. I think it isn't worth to copy this behaviour.
--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
Commits
-
Improve behavior of to_timestamp()/to_date() functions
- cf984672427e 12.0 landed
-
Implement TZH and TZM timestamp format patterns
- 11b623dd0a2c 11.0 cited
-
as attache of this mail is patch (to the main tree) with to_char's
- b866d2e2d794 7.1.1 cited