Alvaro Herrera <alvhe...@2ndquadrant.com> writes: > On 2020-Jan-22, Tom Lane wrote: >> Arthur Zakirov <zaar...@gmail.com> writes: >>> Shouldn't we just show all remaining string instead of truncating it?
>> That would avoid a bunch of arbitrary decisions, for sure. >> Anybody have an objection? > I think it would be clearer to search for whitespace starting at the > start of the bogus token and stop there. It might not be perfect, > particularly if any language has whitespace in a month etc name (I don't > know any example but I guess it's not impossible for it to exist; > Portuguese weekday names maybe?), but it seems better than either of the > behaviors shown above. I'm okay with that. It won't work so well for cases like "1-Januzry-1999", but it's still better than what happens now: regression=# select to_date('1-Januzry-1999', 'DD MONTH YYYY'); ERROR: invalid value "Januzry-1" for "MONTH" That particular case could be improved by stopping at a dash ... but since this code is also used to match strings like "A.M.", we can't just exclude punctuation in general. Breaking at whitespace seems like a reasonable compromise. regards, tom lane