@@ -75,11 +75,11 @@ CONTEXT: JSON data, line 1: ...
75
75
-- use octet_length here so we don't get an odd unicode char in the
76
76
-- output
77
77
SELECT octet_length('"\uaBcD"'::jsonb::text); -- OK, uppercase and lower case both OK
78
- ERROR: unsupported Unicode escape sequence
79
- LINE 1: SELECT octet_length('"\uaBcD"'::jsonb::text);
80
- ^
81
- DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
82
- CONTEXT: JSON data, line 1: ...
78
+ octet_length
79
+ --------------
80
+ 5
81
+ (1 row)
82
+
83
83
-- Numbers.
84
84
SELECT '1'::jsonb; -- OK
85
85
jsonb
@@ -1957,11 +1957,11 @@ SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":[100,200
1957
1957
1958
1958
-- handling of unicode surrogate pairs
1959
1959
SELECT octet_length((jsonb '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a')::text) AS correct_in_utf8;
1960
- ERROR: unsupported Unicode escape sequence
1961
- LINE 1: SELECT octet_length((jsonb '{ "a": "\ud83d\ude04\ud83d\udc3...
1962
- ^
1963
- DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
1964
- CONTEXT: JSON data, line 1: { "a":...
1960
+ correct_in_utf8
1961
+ -----------------
1962
+ 10
1963
+ (1 row)
1964
+
1965
1965
SELECT jsonb '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
1966
1966
ERROR: invalid input syntax for type json
1967
1967
LINE 1: SELECT jsonb '{ "a": "\ud83d\ud83d" }' -> 'a';
@@ -1988,11 +1988,11 @@ DETAIL: Unicode low surrogate must follow a high surrogate.
1988
1988
CONTEXT: JSON data, line 1: { "a":...
1989
1989
-- handling of simple unicode escapes
1990
1990
SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' as correct_in_utf8;
1991
- ERROR: unsupported Unicode escape sequence
1992
- LINE 1: SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' as corr...
1993
- ^
1994
- DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
1995
- CONTEXT: JSON data, line 1: { "a":...
1991
+ correct_in_utf8
1992
+ -------------------------------
1993
+ {"a": "the Copyright © sign"}
1994
+ (1 row)
1995
+
1996
1996
SELECT jsonb '{ "a": "dollar \u0024 character" }' as correct_everywhere;
1997
1997
correct_everywhere
1998
1998
-----------------------------
@@ -2018,11 +2018,11 @@ SELECT jsonb '{ "a": "null \\u0000 escape" }' as not_an_escape;
2018
2018
(1 row)
2019
2019
2020
2020
SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
2021
- ERROR: unsupported Unicode escape sequence
2022
- LINE 1: SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' ->> 'a'...
2023
- ^
2024
- DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
2025
- CONTEXT: JSON data, line 1: { "a":...
2021
+ correct_in_utf8
2022
+ ----------------------
2023
+ the Copyright © sign
2024
+ (1 row)
2025
+
2026
2026
SELECT jsonb '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
2027
2027
correct_everywhere
2028
2028
--------------------
0 commit comments