1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a JSON bug introduced by the optimization of [df099ad713011b67] and

first appearing in 3.43.0.  The problem occurs when doing a JSON_EXTRACT()
on an array element that was added by JSON_SET() without first reparsing.
Reported by [forum:/forumpost/fc0e3f1e2a|forum post fc0e3f1e2a].

FossilOrigin-Name: e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58
This commit is contained in:
drh
2023-10-17 13:41:41 +00:00
parent 5e0b11bda7
commit 52d934e316
4 changed files with 22 additions and 8 deletions

View File

@ -1042,5 +1042,18 @@ do_execsql_test json101-22.2 {
);
} {{{"a":2,"b":4,"c":6}}}
# 2023-10-17 https://sqlite.org/forum/forumpost/fc0e3f1e2a
# Incorrect accesss to '$[0]' in parsed + edited JSON.
#
do_execsql_test json101-23.1 {
SELECT j, j->>0, j->>1
FROM (SELECT json_set(json_set('[]','$[#]',0), '$[#]',1) AS j);
} {{[0,1]} 0 1}
do_execsql_test json101-23.2 {
SELECT j, j->>0, j->>1
FROM (SELECT json_set('[]','$[#]',0,'$[#]',1) AS j);
} {{[0,1]} 0 1}
finish_test