Incorrect result that might be caused by json function
(1) By ChiZhang on 2023-03-01 11:53:04 [source]
Consider the following test case:
CREATE TABLE t0(c0);
INSERT INTO t0 VALUES ('1');
CREATE VIEW v0(c0) AS SELECT CASE WHEN 1 THEN json_patch('1', '1') END FROM t0 GROUP BY t0.c0;
SELECT * FROM v0 WHERE json_quote(v0.c0) != '1';
This query produces an empty result, which I believe, is unexpected. Since json_quote(v0.c0)
will return '”1”'
, which not equals to '1'
, so this condition is true and I expect the result to be '1'
. Note that this reproduces also on the latest trunk version (4fe1419a).
(2) By Richard Hipp (drh) on 2023-03-01 15:25:20 in reply to 1 [link] [source]
This is the same problem that was reported by forum post 3d9caa45cbe38c78. However, the prior fix to that problem (check-in bbaf1f2eb1e1637b) was incomplete. Newer check-in e72661eb680ea707 added moments ago should complete the fix and resolve the test case shown here.