Re: [HACKERS] Bug in to_timestamp().
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Arthur Zakirov <a.zakirov@postgrespro.ru>
Cc: amul sul <sulamul@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
"David G. Johnston" <david.g.johnston@gmail.com>,
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: 2017-11-19T17:26:39Z
Lists: pgsql-hackers
Arthur Zakirov <a.zakirov@postgrespro.ru> writes:
> On Sat, Nov 18, 2017 at 05:48:26PM -0500, Tom Lane wrote:
>> ... I see from your regression test additions that
>> you want to make some of these throw an error, and I think that any such
>> proposal is dead in the water. Nobody is going to consider it an
>> improvement if it both breaks working PG apps and disagrees with Oracle.
> Only queries with FX field throw an error.
Ah, I see --- I'd missed that FX was relevant to this. Yeah, maybe
it'd be okay to tighten up in that case, since that's making it act more
like Oracle, which seems to be generally agreed to be a good thing.
I don't much like the error message that you've got:
+SELECT to_timestamp('97/Feb/16', 'FXYY:Mon:DD');
+ERROR: unexpected character "/", expected ":"
+DETAIL: The given value did not match any of the allowed values for this field.
The DETAIL message seems to have been copied-and-pasted into a context
where it's not terribly accurate. I'd consider replacing it with
something along the lines of "HINT: In FX mode, punctuation in the input
string must exactly match the format string." This way the report will
contain a pretty clear statement of the new rule that was broken. (BTW,
it's a hint not a detail because it might be guessing wrong as to what
the real problem is.)
regards, tom lane
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