JSON validation behavior
От | Sergei Kornilov |
---|---|
Тема | JSON validation behavior |
Дата | |
Msg-id | 6996811540391041@sas1-890ba5c2334a.qloud-c.yandex.net обсуждение исходный текст |
Ответы |
Re: JSON validation behavior
|
Список | pgsql-hackers |
Hi We have some json regression tests in src/test/regress/expected/json_encoding_1.out with \u0000 symbol select json '{ "a": "null \u0000 escape" }' as not_unescaped; not_unescaped -------------------------------- { "a": "null \u0000 escape" } (1 row) select json '{ "a": "null \u0000 escape" }' ->> 'a' as fails; ERROR: unsupported Unicode escape sequence DETAIL: \u0000 cannot be converted to text. CONTEXT: JSON data, line 1: { "a":... Well, requested text type can not have \u0000 byte. But seems strange: we test json type with this value but raise same errorfor -> operator: melkij=> select json '{ "a": "null \u0000 escape"}' -> 'a' as fails; ERROR: unsupported Unicode escape sequence DETAIL: \u0000 cannot be converted to text. CONTEXT: JSON data, line 1: { "a":... Result was requested in json datatype, like 'SELECT '"\u0000"'::json;' from tests before. Similar error with access by different key: melkij=> select json '{ "a": "null \u0000 escape", "b":1 }' ->>'b' as fails; ERROR: unsupported Unicode escape sequence DETAIL: \u0000 cannot be converted to text. CONTEXT: JSON data, line 1: { "a":... We allow write such json to table, we allow read whole json, but we can not use native operators. Is this behavior expected? regards, Sergei
В списке pgsql-hackers по дате отправления: