Re: ASCII Null control character validation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexey Chernyshov <a(dot)chernyshov(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ASCII Null control character validation
Date: 2017-11-30 14:35:43
Message-ID: 85266.1512052543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexey Chernyshov <a(dot)chernyshov(at)postgrespro(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-11-30 14:49:53 Re: [HACKERS] create_unique_path and GEQO
Previous Message Tom Lane 2017-11-30 14:22:43 Re: [HACKERS] postgres_fdw bug in 9.6