Re: pg should ignore u+200b zero width space

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: James Cloos <cloos(at)jhcloos(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: pg should ignore u+200b zero width space
Date: 2020-11-03 13:52:45
Message-ID: e1c98248-ac7b-5fd2-0b74-86669054d58a@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 03/11/2020 15:41, James Cloos wrote:
> i had a hell of a night last night trying to figure out what was wrong
> with an attempt to use on constraint.
>
> this morning i tried again and it worked.
>
> but pasting the failed line from .psql_history into psql still failed.
>
> i had to resort to od(1) to discover a no break space showed up just
> before on constraint in the failing lines.
>
> pg should treat a no break space after whitespace as just more
> whitespace.
>
> i'm not sure about alone between printing characters, but definitely
> immediately after current whitespace characters.

Hmm. I'm not sure if change the behavior is a good idea, but a hint in
the error message would be nice. Something like:

postgres=# insert ​into foo values (1);
ERROR: syntax error at or near "​into"
LINE 1: insert ​into foo values (1);
^
HINT: There is a zero-width space character (U+200B) on the line.

Patches are welcome. Are there other problematic characters like that?

- Heikki

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Guillaume Lelarge 2020-11-03 14:25:54 Re: BUG #16698: Create extension and search path
Previous Message James Cloos 2020-11-03 13:41:23 pg should ignore u+200b zero width space