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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix unescaping of JSON Unicode escapes, especially for non-UTF8.
Date: 2013-06-12 17:44:06
Message-ID: E1Ump5a-00023B-VR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-06-12 21:53:53 pgsql: Improve updatability checking for views and foreign tables.
Previous Message Robert Haas 2013-06-12 16:31:28 pgsql: Improve description of loread/lowrite.