From 7a2c9017aa9af36a8962f6764d2313dcdda59f7c Mon Sep 17 00:00:00 2001 From: "D. Richard Hipp" Date: Wed, 4 Oct 2017 14:13:29 +0000 Subject: [PATCH] New test cases for ticket [b899b6042f97f5] derived from a bug report on the mailing list from Wout Mertens. --- test/whereF.test | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/whereF.test b/test/whereF.test index a2361cfd16..0888f25789 100644 --- a/test/whereF.test +++ b/test/whereF.test @@ -195,7 +195,24 @@ ifcapable json1 { SELECT * FROM t6 WHERE (EXISTS (SELECT 1 FROM json_each(t6.c) AS x WHERE x.value=1)); } {1 {} {{"a":1,"b":[3,4,5],"c":{"x":4.5,"y":7.8}}}} - + + # Another test case derived from a posting by Wout Mertens on the + # sqlite-users mailing list on 2017-10-04. + do_execsql_test 6.3 { + DROP TABLE IF EXISTS t; + CREATE TABLE t(json JSON); + SELECT * FROM t + WHERE(EXISTS(SELECT 1 FROM json_each(t.json,"$.foo") j + WHERE j.value = 'meep')); + } {} + do_execsql_test 6.4 { + INSERT INTO t VALUES('{"xyzzy":null}'); + INSERT INTO t VALUES('{"foo":"meep","other":12345}'); + INSERT INTO t VALUES('{"foo":"bingo","alt":5.25}'); + SELECT * FROM t + WHERE(EXISTS(SELECT 1 FROM json_each(t.json,"$.foo") j + WHERE j.value = 'meep')); + } {{{"foo":"meep","other":12345}}} } finish_test -- 2.11.4.GIT