SQLite

View Ticket
Login
Ticket Hash: b2d4edaffdc156ccebca2aab945215b4d75ba912
Title: Comparison on view malfunctions
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-10-07 01:07:56
Version Found In: 3.30.0
User Comments:
mrigger added on 2019-10-05 21:09:57:

Consider the following example:

CREATE TABLE t0(c0);
INSERT INTO t0(c0) VALUES (0);
CREATE VIEW v0(c0) AS SELECT t0.rowid FROM t0 ORDER BY 1;
SELECT COUNT(*) FROM v0 WHERE ABS('1') = v0.c0; -- expected: 1, actual: 0

The COUNT()'s result indicates that the value in the table does not match the condition in the WHERE clause. However, the following query indicates that it does:

SELECT ABS('1') = v0.c0 FROM v0; -- 1