SQLite

View Ticket
Login
2019-06-14
12:29 Fixed ticket [ce8717f0]: LIKE malfunctions for UNIQUE COLLATE NOCASE column plus 6 other changes (artifact: 751df5f0 user: drh)
12:28
Refactor the LIKE optimization decision logic so that it uses sqlite3AtoF() on both boundary keys to determine if the optimization can be used when the LHS is something that might not have TEXT affinity. Ticket [ce8717f0885af975]. See also [c94369cae9b561b1], [b043a54c3de54b28], [fd76310a5e843e07], and [158290c0abafde67]. (check-in: b4a9e09e user: drh tags: trunk)
10:01 New ticket [ce8717f0] LIKE malfunctions for UNIQUE COLLATE NOCASE column. (artifact: 81eff856 user: mrigger)

Ticket Hash: ce8717f0885af975dbdce9cedb342d5822901a12
Title: LIKE malfunctions for UNIQUE COLLATE NOCASE column
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-06-14 12:29:07
Version Found In:
User Comments:
mrigger added on 2019-06-14 10:01:47:

Consider this example:

CREATE TABLE t0(c0 INT UNIQUE COLLATE NOCASE);
INSERT INTO t0(c0) VALUES ('.1%');
SELECT * FROM t0 WHERE t0.c0 LIKE '.1%'; -- expected: '.1%', actual: no row is fetched

Although the LIKE expression should yield 1 (see below), no row is fetched:

SELECT t0.c0 LIKE '.1%' FROM t0; -- 1

It seems that this problem only applies to COLLATE NOCASE as well as to numeric columns (INT, REAL, and NUMERIC).