SQLite

View Ticket
Login
2019-09-03
14:27 Fixed ticket [767a8cbc]: COLLATE NOCASE string comparison yields incorrect result plus 6 other changes (artifact: 126c7225 user: drh)
14:27
When we play games with COLLATE in order to commute an operator in the WHERE clause processing, be sure not to use the commuted operator to qualify a partial index, as insufficient COLLATE information is preserved to verify that the expression will correctly qualify the index. Ticket [767a8cbc6d20bd68] (check-in: 5351e920 user: drh tags: trunk)
08:25 New ticket [767a8cbc] COLLATE NOCASE string comparison yields incorrect result. (artifact: b41bd360 user: mrigger)

Ticket Hash: 767a8cbc6d20bd684d48dfd67469e3c55af0f825
Title: COLLATE NOCASE string comparison yields incorrect result
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-09-03 14:27:40
Version Found In: 3.29.0
User Comments:
mrigger added on 2019-09-03 08:25:35:

In the test case below, a row is unexpectedly not fetched:

CREATE TABLE t0(c0 COLLATE NOCASE, c1);
CREATE INDEX i0 ON t0(0) WHERE c0 >= c1;
REPLACE INTO t0 VALUES('a', 'B');
SELECT * FROM t0 WHERE t0.c1 <= t0.c0; -- unexpected: row is not fetched

The WHERE expression evaluates to TRUE:

SELECT t0.c1 <= t0.c0 FROM t0; -- TRUE