/ View Ticket
Login
2009-12-24
16:01 Fixed ticket [eb5548a8]: CAST in WHERE clause causes inconsistent query results plus 3 other changes (artifact: 5ad1607e user: drh)
16:00
Immediately purge entries from the column cache when the associated register undergoes an affinity change. Ticket [eb5548a849]. Enhance the SQLITE_TESTCTRL_OPTIMIZATIONS setting of sqlite3_test_control so that it can disable the column cache for testing purposes, in an effort to prevent future problems of a similar nature to this one. (check-in: ea4e57e1 user: drh tags: trunk)
13:16 New ticket [eb5548a8] CAST in WHERE clause causes inconsistent query results. (artifact: cd72ca77 user: drh)

Ticket Hash: eb5548a8496477212d80c4aa4bcb035d5e330211
Title: CAST in WHERE clause causes inconsistent query results
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2009-12-24 16:01:52
Version Found In: 3.6.21
Description:
In the following code, the two queries get different answers:
CREATE TABLE t1(x);
INSERT INTO t1 VALUES('1');
SELECT 1, x FROM t1 WHERE cast(x AS int)=1 AND x='1';
SELECT 2, x FROM t1 WHERE x='1' AND cast(x AS int)=1;

The faulty behavior first appeared in SQLite version 3.6.14.


drh added on 2009-12-24 16:01:52:
Fixed by check-in [ea4e57e1c1b6663ceb12872e31a8503f6c14e3d8].