43
43
DETAIL: Escape sequence "\v" is invalid.
44
44
CONTEXT: JSON data, line 1: "\v...
45
SELECT '"\u"'::json; -- ERROR, incomplete escape
46
ERROR: invalid input syntax for type json
47
LINE 1: SELECT '"\u"'::json;
49
DETAIL: "\u" must be followed by four hexadecimal digits.
50
CONTEXT: JSON data, line 1: "\u"
51
SELECT '"\u00"'::json; -- ERROR, incomplete escape
52
ERROR: invalid input syntax for type json
53
LINE 1: SELECT '"\u00"'::json;
55
DETAIL: "\u" must be followed by four hexadecimal digits.
56
CONTEXT: JSON data, line 1: "\u00"
57
SELECT '"\u000g"'::json; -- ERROR, g is not a hex digit
58
ERROR: invalid input syntax for type json
59
LINE 1: SELECT '"\u000g"'::json;
61
DETAIL: "\u" must be followed by four hexadecimal digits.
62
CONTEXT: JSON data, line 1: "\u000g...
63
SELECT '"\u0000"'::json; -- OK, legal escape
69
SELECT '"\uaBcD"'::json; -- OK, uppercase and lower case both OK
45
-- see json_encoding test for input with unicode escapes
76
47
SELECT '1'::json; -- OK
936
907
ERROR: cannot call json_populate_recordset on a nested object
937
908
select * from json_populate_recordset(row('def',99,null)::jpop,'[{"c":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q;
938
909
ERROR: cannot call json_populate_recordset on a nested object
939
select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8;
941
----------------------------
942
"\ud83d\ude04\ud83d\udc36"
945
select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
946
ERROR: invalid input syntax for type json
947
DETAIL: Unicode high surrogate must not follow a high surrogate.
948
CONTEXT: JSON data, line 1: { "a":...
949
select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
950
ERROR: invalid input syntax for type json
951
DETAIL: Unicode low surrogate must follow a high surrogate.
952
CONTEXT: JSON data, line 1: { "a":...
953
select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
954
ERROR: invalid input syntax for type json
955
DETAIL: Unicode low surrogate must follow a high surrogate.
956
CONTEXT: JSON data, line 1: { "a":...
957
select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
958
ERROR: invalid input syntax for type json
959
DETAIL: Unicode low surrogate must follow a high surrogate.
960
CONTEXT: JSON data, line 1: { "a":...
961
--handling of simple unicode escapes
962
select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
964
----------------------
968
select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
974
select json '{ "a": "null \u0000 escape" }' ->> 'a' as not_unescaped;