diff options
author | drh <> | 2023-12-06 17:50:16 +0000 |
---|---|---|
committer | drh <> | 2023-12-06 17:50:16 +0000 |
commit | a9c8469d033d610c52f666e827f2bae2df47fbdb (patch) | |
tree | 4a5cfb204b75156540d6e17c71385171e77c2402 /test | |
parent | b597fea89436a57b8b4bc39f24dc7e14f5e92dcb (diff) | |
parent | 9df01b5ccf78535dd44e1f8c0b83fcee40ea5042 (diff) | |
download | sqlite-a9c8469d033d610c52f666e827f2bae2df47fbdb.tar.gz sqlite-a9c8469d033d610c52f666e827f2bae2df47fbdb.zip |
Do correct comparisons between object labels in JSON even when the two labels
contain different JSON escapes.
FossilOrigin-Name: bda2e30cc22e180b19a7a05824dd345880eb402ae5450b2d2dd954946c3ae135
Diffstat (limited to 'test')
-rw-r--r-- | test/json502.test | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/json502.test b/test/json502.test index 595bf6331..48c372c4f 100644 --- a/test/json502.test +++ b/test/json502.test @@ -36,5 +36,30 @@ do_catchsql_test 2.3 { SELECT '{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}'->'$h[#-1]'; } {1 {malformed JSON}} +# Verify that escaped label names are compared correctly. +# +do_execsql_test 3.1 { + SELECT '{"a\x62c":123}' ->> 'abc'; +} 123 +do_execsql_test 3.2 { + SELECT '{"abc":123}' ->> 'a\x62c'; +} 123 + +db null null +do_execsql_test 3.3 { + DROP TABLE t1; + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(json_insert('{}','$.a\',111,'$."b\\"',222)); + INSERT INTO t1 VALUES(jsonb_insert('{}','$.a\',111,'$."b\\"',222)); + SELECT x->'$.a\', x->'$.a\\', x->'$."a\\"', x->'$."b\\"' FROM t1; +} {111 null 111 222 111 null 111 222} + +do_execsql_test 3.4 { + SELECT json_patch('{"a\x62c":123}','{"ab\x63":456}') ->> 'abc'; +} 456 + +do_execsql_test 4.1 { + SELECT * FROM json_tree('{"\u0017":1}','$."\x17"'); +} {{\x17} 1 integer 1 1 null {$."\x17"} {$}} finish_test |