Re: pg should ignore u+200b zero width space - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: pg should ignore u+200b zero width space
Date
Msg-id e1c98248-ac7b-5fd2-0b74-86669054d58a@iki.fi
Whole thread Raw
In response to pg should ignore u+200b zero width space  (James Cloos <cloos@jhcloos.com>)
Responses Re: pg should ignore u+200b zero width space
List 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



pgsql-bugs by date:

Previous
From: James Cloos
Date:
Subject: pg should ignore u+200b zero width space
Next
From: Guillaume Lelarge
Date:
Subject: Re: BUG #16698: Create extension and search path