You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix some minor spec-compliance issues in jsonpath lexer.
Although the SQL/JSON tech report makes reference to ECMAScript which
allows both single- and double-quoted strings, all the rest of the
report speaks only of double-quoted string literals in jsonpaths.
That's more compatible with JSON itself; moreover single-quoted strings
are hard to use inside a jsonpath that is itself a single-quoted SQL
literal. So guess that the intent is to allow only double-quoted
literals, and remove lexer support for single-quoted literals.
It'll be less painful to add this again later if we're wrong, than to
remove a shipped feature.
Also, adjust the lexer so that unrecognized backslash sequences are
treated as just meaning the escaped character, not as errors. This
change has much better support in the standards, as JSON, JavaScript
and ECMAScript all make it plain that that's what's supposed to
happen.
Back-patch to v12.
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%2B_Rv2rNRqfg@mail.gmail.com
ERROR: invalid Unicode surrogate pair at or near "E'\'\ude04"
125
-
LINE 1: select E'\'\ude04X\''::jsonpath;
126
-
^
127
-
--handling of simple unicode escapes
128
-
select E'\'the Copyright \u00a9 sign\''::jsonpath as correct_in_utf8;
129
-
ERROR: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8 at or near "E'\'the Copyright \u00a9"
130
-
LINE 1: select E'\'the Copyright \u00a9 sign\''::jsonpath as correct...
131
-
^
132
-
select E'\'dollar \u0024 character\''::jsonpath as correct_everywhere;
133
-
correct_everywhere
134
-
----------------------
135
-
"dollar $ character"
136
-
(1 row)
137
-
138
-
select E'\'dollar \\u0024 character\''::jsonpath as not_an_escape;
139
-
not_an_escape
140
-
----------------------
141
-
"dollar $ character"
142
-
(1 row)
143
-
144
-
select E'\'null \u0000 escape\''::jsonpath as not_unescaped;
145
-
ERROR: invalid Unicode escape value at or near "E'\'null \u0000"
146
-
LINE 1: select E'\'null \u0000 escape\''::jsonpath as not_unescaped;
147
-
^
148
-
select E'\'null \\u0000 escape\''::jsonpath as not_an_escape;
149
-
ERROR: unsupported Unicode escape sequence
150
-
LINE 1: select E'\'null \\u0000 escape\''::jsonpath as not_an_escape...
0 commit comments