pgsql: Fix unescaping of JSON Unicode escapes, especially for non-UTF8. - Mailing list pgsql-committers

From Andrew Dunstan
Subject pgsql: Fix unescaping of JSON Unicode escapes, especially for non-UTF8.
Date
Msg-id E1Ump5a-00023B-VR@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix unescaping of JSON Unicode escapes, especially for non-UTF8.

Per discussion  on -hackers. We treat Unicode escapes when unescaping
them similarly to the way we treat them in PostgreSQL string literals.
Escapes in the ASCII range are always accepted, no matter what the
database encoding. Escapes for higher code points are only processed in
UTF8 databases, and attempts to process them in other databases will
result in an error. \u0000 is never unescaped, since it would result in
an impermissible null byte.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/78ed8e03c67d7333708f5c1873ec1d239ae2d7e0

Modified Files
--------------
doc/src/sgml/func.sgml               |   11 +
src/backend/utils/adt/json.c         |   42 +-
src/test/regress/expected/json.out   |   23 +-
src/test/regress/expected/json_1.out |  960 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/json.sql        |    8 +-
5 files changed, 1033 insertions(+), 11 deletions(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Improve description of loread/lowrite.
Next
From: Tom Lane
Date:
Subject: pgsql: Improve updatability checking for views and foreign tables.