Koichi Suzuki <koichi.dbms@gmail.com> writes:
> Lexical analysis of backshash commands in psql is handled
> by psqlscanslash.l and this module scans iput byte-by-byte, not
> character-by-character. I'm afraid that the cause of the bug is in
> this part.. Is there any way to make this flex syntax local-dependent?
I think you're mistaken: see the "safe_encoding" hackery in
psqlscan.l (which does also operate for the rules in psqlscanslash.l).
Now it could be that psqlscan.l has been misinformed about the
encoding that's in use, but that wouldn't be its fault.
regards, tom lane