Обсуждение: pgsql: Do not escape a unicode sequence when escaping JSON text.

Поиск
Список
Период
Сортировка

pgsql: Do not escape a unicode sequence when escaping JSON text.

От
Andrew Dunstan
Дата:
Do not escape a unicode sequence when escaping JSON text.

Previously, any backslash in text being escaped for JSON was doubled so
that the result was still valid JSON. However, this led to some perverse
results in the case of Unicode sequences, These are now detected and the
initial backslash is no longer escaped. All other backslashes are
still escaped. No validity check is performed, all that is looked for is
\uXXXX where X is a hexidecimal digit.

This is a change from the 9.2 and 9.3 behaviour as noted in the Release
notes.

Per complaint from Teodor Sigaev.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0ad1a816320a2b539a51628e2a0b1e83ff096b1d

Modified Files
--------------
doc/src/sgml/release-9.4.sgml         |   15 +++++++++++++++
src/backend/utils/adt/json.c          |   21 ++++++++++++++++++++-
src/test/regress/expected/json.out    |   14 ++++++++++++++
src/test/regress/expected/json_1.out  |   14 ++++++++++++++
src/test/regress/expected/jsonb.out   |    6 +++---
src/test/regress/expected/jsonb_1.out |    6 +++---
src/test/regress/sql/json.sql         |    8 ++++++++
7 files changed, 77 insertions(+), 7 deletions(-)