Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 03/11/2020 16:52, Tom Lane wrote:
>> Perhaps it'd be all right to confine the change in behavior to
>> just modifying the error text in cases where we were going to
>> throw an error anyway. But I think this is much harder than
>> it sounds to do in a valid, safe way.
> Yeah, my thinking was to just add a hint when you're throwing a syntax
> error anyway. Something simple like check if client_encoding is utf8 and
> there is a U+200b in the query string, and add the hint if so. It
> doesn't need to catch all cases, and rare false positives are OK too.
TBH, that's exactly the kind of under-baked solution I *don't* want.
For starters, &zwsp is hardly the only problem here; even more common
is  , which exists in most encodings not only UTF8. And once we
had that, there'd no doubt be pressure to ignore BOMs. And so on.
Also I don't really want us throwing such errors when the funny space is
inside a literal or comment; chasing false positives like that will cost
users way more time than they could save when the hint is on-point.
regards, tom lane