SQLite

View Ticket
Login
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].