@@ -35,23 +35,23 @@ SELECT '"\uaBcD"'::json; -- OK, uppercase and lower case both OK
35
35
select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8;
36
36
ERROR: unsupported Unicode escape sequence
37
37
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
38
- CONTEXT: JSON data, line 1: { "a":...
38
+ CONTEXT: JSON data, line 1: { "a": "\ud83d\ude04 ...
39
39
select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
40
40
ERROR: invalid input syntax for type json
41
41
DETAIL: Unicode high surrogate must not follow a high surrogate.
42
- CONTEXT: JSON data, line 1: { "a":...
42
+ CONTEXT: JSON data, line 1: { "a": "\ud83d\ud83d ...
43
43
select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
44
44
ERROR: invalid input syntax for type json
45
45
DETAIL: Unicode low surrogate must follow a high surrogate.
46
- CONTEXT: JSON data, line 1: { "a":...
46
+ CONTEXT: JSON data, line 1: { "a": "\ude04 ...
47
47
select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
48
48
ERROR: invalid input syntax for type json
49
49
DETAIL: Unicode low surrogate must follow a high surrogate.
50
- CONTEXT: JSON data, line 1: { "a":...
50
+ CONTEXT: JSON data, line 1: { "a": "\ud83dX ...
51
51
select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
52
52
ERROR: invalid input syntax for type json
53
53
DETAIL: Unicode low surrogate must follow a high surrogate.
54
- CONTEXT: JSON data, line 1: { "a":...
54
+ CONTEXT: JSON data, line 1: { "a": "\ude04 ...
55
55
--handling of simple unicode escapes
56
56
select json '{ "a": "the Copyright \u00a9 sign" }' as correct_in_utf8;
57
57
correct_in_utf8
@@ -86,7 +86,7 @@ select json '{ "a": "null \\u0000 escape" }' as not_an_escape;
86
86
select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
87
87
ERROR: unsupported Unicode escape sequence
88
88
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
89
- CONTEXT: JSON data, line 1: { "a":...
89
+ CONTEXT: JSON data, line 1: { "a": "the Copyright \u00a9 ...
90
90
select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
91
91
correct_everywhere
92
92
--------------------
@@ -102,7 +102,7 @@ select json '{ "a": "dollar \\u0024 character" }' ->> 'a' as not_an_escape;
102
102
select json '{ "a": "null \u0000 escape" }' ->> 'a' as fails;
103
103
ERROR: unsupported Unicode escape sequence
104
104
DETAIL: \u0000 cannot be converted to text.
105
- CONTEXT: JSON data, line 1: { "a":...
105
+ CONTEXT: JSON data, line 1: { "a": "null \u0000 ...
106
106
select json '{ "a": "null \\u0000 escape" }' ->> 'a' as not_an_escape;
107
107
not_an_escape
108
108
--------------------
@@ -140,53 +140,53 @@ ERROR: unsupported Unicode escape sequence
140
140
LINE 1: SELECT '"\u0000"'::jsonb;
141
141
^
142
142
DETAIL: \u0000 cannot be converted to text.
143
- CONTEXT: JSON data, line 1: ...
143
+ CONTEXT: JSON data, line 1: "\u0000 ...
144
144
-- use octet_length here so we don't get an odd unicode char in the
145
145
-- output
146
146
SELECT octet_length('"\uaBcD"'::jsonb::text); -- OK, uppercase and lower case both OK
147
147
ERROR: unsupported Unicode escape sequence
148
148
LINE 1: SELECT octet_length('"\uaBcD"'::jsonb::text);
149
149
^
150
150
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
151
- CONTEXT: JSON data, line 1: ...
151
+ CONTEXT: JSON data, line 1: "\uaBcD ...
152
152
-- handling of unicode surrogate pairs
153
153
SELECT octet_length((jsonb '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a')::text) AS correct_in_utf8;
154
154
ERROR: unsupported Unicode escape sequence
155
155
LINE 1: SELECT octet_length((jsonb '{ "a": "\ud83d\ude04\ud83d\udc3...
156
156
^
157
157
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
158
- CONTEXT: JSON data, line 1: { "a":...
158
+ CONTEXT: JSON data, line 1: { "a": "\ud83d\ude04 ...
159
159
SELECT jsonb '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
160
160
ERROR: invalid input syntax for type json
161
161
LINE 1: SELECT jsonb '{ "a": "\ud83d\ud83d" }' -> 'a';
162
162
^
163
163
DETAIL: Unicode high surrogate must not follow a high surrogate.
164
- CONTEXT: JSON data, line 1: { "a":...
164
+ CONTEXT: JSON data, line 1: { "a": "\ud83d\ud83d ...
165
165
SELECT jsonb '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
166
166
ERROR: invalid input syntax for type json
167
167
LINE 1: SELECT jsonb '{ "a": "\ude04\ud83d" }' -> 'a';
168
168
^
169
169
DETAIL: Unicode low surrogate must follow a high surrogate.
170
- CONTEXT: JSON data, line 1: { "a":...
170
+ CONTEXT: JSON data, line 1: { "a": "\ude04 ...
171
171
SELECT jsonb '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
172
172
ERROR: invalid input syntax for type json
173
173
LINE 1: SELECT jsonb '{ "a": "\ud83dX" }' -> 'a';
174
174
^
175
175
DETAIL: Unicode low surrogate must follow a high surrogate.
176
- CONTEXT: JSON data, line 1: { "a":...
176
+ CONTEXT: JSON data, line 1: { "a": "\ud83dX ...
177
177
SELECT jsonb '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
178
178
ERROR: invalid input syntax for type json
179
179
LINE 1: SELECT jsonb '{ "a": "\ude04X" }' -> 'a';
180
180
^
181
181
DETAIL: Unicode low surrogate must follow a high surrogate.
182
- CONTEXT: JSON data, line 1: { "a":...
182
+ CONTEXT: JSON data, line 1: { "a": "\ude04 ...
183
183
-- handling of simple unicode escapes
184
184
SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' as correct_in_utf8;
185
185
ERROR: unsupported Unicode escape sequence
186
186
LINE 1: SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' as corr...
187
187
^
188
188
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
189
- CONTEXT: JSON data, line 1: { "a":...
189
+ CONTEXT: JSON data, line 1: { "a": "the Copyright \u00a9 ...
190
190
SELECT jsonb '{ "a": "dollar \u0024 character" }' as correct_everywhere;
191
191
correct_everywhere
192
192
-----------------------------
@@ -204,7 +204,7 @@ ERROR: unsupported Unicode escape sequence
204
204
LINE 1: SELECT jsonb '{ "a": "null \u0000 escape" }' as fails;
205
205
^
206
206
DETAIL: \u0000 cannot be converted to text.
207
- CONTEXT: JSON data, line 1: { "a":...
207
+ CONTEXT: JSON data, line 1: { "a": "null \u0000 ...
208
208
SELECT jsonb '{ "a": "null \\u0000 escape" }' as not_an_escape;
209
209
not_an_escape
210
210
------------------------------
@@ -216,7 +216,7 @@ ERROR: unsupported Unicode escape sequence
216
216
LINE 1: SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' ->> 'a'...
217
217
^
218
218
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
219
- CONTEXT: JSON data, line 1: { "a":...
219
+ CONTEXT: JSON data, line 1: { "a": "the Copyright \u00a9 ...
220
220
SELECT jsonb '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
221
221
correct_everywhere
222
222
--------------------
@@ -234,7 +234,7 @@ ERROR: unsupported Unicode escape sequence
234
234
LINE 1: SELECT jsonb '{ "a": "null \u0000 escape" }' ->> 'a' as fai...
235
235
^
236
236
DETAIL: \u0000 cannot be converted to text.
237
- CONTEXT: JSON data, line 1: { "a":...
237
+ CONTEXT: JSON data, line 1: { "a": "null \u0000 ...
238
238
SELECT jsonb '{ "a": "null \\u0000 escape" }' ->> 'a' as not_an_escape;
239
239
not_an_escape
240
240
--------------------
0 commit comments