Re: ASCII Null control character validation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ASCII Null control character validation
Date
Msg-id 85266.1512052543@sss.pgh.pa.us
Whole thread Raw
In response to ASCII Null control character validation  (Alexey Chernyshov <a.chernyshov@postgrespro.ru>)
List pgsql-hackers
Alexey Chernyshov <a.chernyshov@postgrespro.ru> writes:
> I found in src/backend/utils/mb/wchar.c: pg_verify_mbstr_len() that it
> reports ASCII Null character (\000) as invalid. As for me, it should
> pass validation.

This is intentional and we're not going to change it.  There is too
much code in the backend that relies on NUL-terminated strings ...

> However, ASCII Null character breaks a line and the
> end of the line is missed, try:
> INSERT INTO mytable VALUES (E'a\001b\000c and rest of line MIA');

... like that for instance.  See (many) past discussions of this issue.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] postgres_fdw bug in 9.6
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] create_unique_path and GEQO