]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix some minor spec-compliance issues in jsonpath lexer.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Sep 2019 18:22:58 +0000 (14:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Sep 2019 18:22:58 +0000 (14:22 -0400)
commit5f3bec0769c1d3c345ee2de30de271dce4feb469
tree75bec197a7cec4199d80ec68ed8d8da451a110ce
parent08e04a5f99d50285edf8e89a18da67ce2d75d676
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
src/backend/utils/adt/jsonpath_scan.l
src/test/regress/expected/jsonpath.out
src/test/regress/expected/jsonpath_encoding.out
src/test/regress/expected/jsonpath_encoding_1.out
src/test/regress/sql/jsonpath.sql
src/test/regress/sql/jsonpath_encoding.sql