1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-11 08:30:57 +03:00

Fix the JSON Path parser so that it will accept zero-length object labels.

[forum/forumpost/c082aeab43|Forum thread c082aeab43].

FossilOrigin-Name: 84fe95d2a5b4d232d657e3b8110027a698a9bcd597f205cc535cfa97bc299f21
This commit is contained in:
drh
2022-04-04 14:24:14 +00:00
parent a81a9f78fd
commit b07fb4f1c2
4 changed files with 30 additions and 12 deletions

View File

@@ -850,4 +850,21 @@ do_execsql_test json-17.1 {
SELECT * FROM t1 LEFT JOIN t2 ON (SELECT b FROM json_each ORDER BY 1);
} {}
# 2022-04-04 forum post https://sqlite.org/forum/forumpost/c082aeab43
do_execsql_test json-18.1 {
SELECT json_valid('{"":5}');
} {1}
do_execsql_test json-18.2 {
SELECT json_extract('{"":5}', '$.""');
} {5}
do_execsql_test json-18.3 {
SELECT json_extract('[3,{"a":4,"":[5,{"hi":6},7]},8]', '$[1].""[1].hi');
} {6}
do_execsql_test json-18.4 {
SELECT json_extract('[3,{"a":4,"":[5,{"hi":6},7]},8]', '$[1].""[1]."hi"');
} {6}
do_catchsql_test json-18.5 {
SELECT json_extract('{"":8}', '$.');
} {1 {JSON path error near ''}}
finish_test