@@ -42,36 +42,7 @@ LINE 1: SELECT '"\v"'::json;
42
42
^
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;
48
- ^
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;
54
- ^
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;
60
- ^
61
- DETAIL: "\u" must be followed by four hexadecimal digits.
62
- CONTEXT: JSON data, line 1: "\u000g...
63
- SELECT '"\u0000"'::json; -- OK, legal escape
64
- json
65
- ----------
66
- "\u0000"
67
- (1 row)
68
-
69
- SELECT '"\uaBcD"'::json; -- OK, uppercase and lower case both OK
70
- json
71
- ----------
72
- "\uaBcD"
73
- (1 row)
74
-
45
+ -- see json_encoding test for input with unicode escapes
75
46
-- Numbers.
76
47
SELECT '1'::json; -- OK
77
48
json
@@ -936,45 +907,3 @@ select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":[100,200,3
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
- -- handling of unicode surrogate pairs
940
- select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8;
941
- correct_in_utf8
942
- ----------------------------
943
- "\ud83d\ude04\ud83d\udc36"
944
- (1 row)
945
-
946
- select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
947
- ERROR: invalid input syntax for type json
948
- DETAIL: Unicode high surrogate must not follow a high surrogate.
949
- CONTEXT: JSON data, line 1: { "a":...
950
- select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
951
- ERROR: invalid input syntax for type json
952
- DETAIL: Unicode low surrogate must follow a high surrogate.
953
- CONTEXT: JSON data, line 1: { "a":...
954
- select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
955
- ERROR: invalid input syntax for type json
956
- DETAIL: Unicode low surrogate must follow a high surrogate.
957
- CONTEXT: JSON data, line 1: { "a":...
958
- select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
959
- ERROR: invalid input syntax for type json
960
- DETAIL: Unicode low surrogate must follow a high surrogate.
961
- CONTEXT: JSON data, line 1: { "a":...
962
- --handling of simple unicode escapes
963
- select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
964
- correct_in_utf8
965
- ----------------------
966
- the Copyright © sign
967
- (1 row)
968
-
969
- select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
970
- correct_everywhere
971
- --------------------
972
- dollar $ character
973
- (1 row)
974
-
975
- select json '{ "a": "null \u0000 escape" }' ->> 'a' as not_unescaped;
976
- not_unescaped
977
- --------------------
978
- null \u0000 escape
979
- (1 row)
980
-
0 commit comments