adding a "like" clause breaks "collate nocase"

Bug #1935724 reported by Bill Yikes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sqlite (Ubuntu)
New
Undecided
Unassigned

Bug Description

/* This shows 1800+ records. Note that foo_tbl values are all title case (except one record), while all values in bar_tbl are all uppercase. This is why "collate nocase" is important */

select foo_tbl.name,trim(bar_tbl.name),foo_tbl.host,bar_tbl.host from foo_tbl join bar_tbl on bar_tbl.uid = foo_tbl.uid where trim(foo_tbl.name) = trim(bar_tbl.name) collate nocase;

/* Adding 'and foo_tbl.host like "%"' should have no effect, but in fact only 1 record is shown. foo_tbl has 1 record where the capitalization matches. This indicates that the new "like" condition is breaking the "collate nocase" */

select foo_tbl.name,trim(bar_tbl.name),foo_tbl.host,bar_tbl.host from foo_tbl join bar_tbl on bar_tbl.uid = foo_tbl.uid where trim(foo_tbl.name) = trim(bar_tbl.name) and foo_tbl.host like '%' collate nocase;

/* Workaround: This hacks around the above problem shows 1800+ records without having to give up the "like" clause. But it's ugly. */

select * from (select foo_tbl.name,trim(bar_tbl.name),foo_tbl.host,host from foo_tbl join bar_tbl on bar_tbl.uid = foo_tbl.id where trim(foo_tbl.name) = trim(bar_tbl.name) collate nocase) where foo_tbl.host like '%';

Bill Yikes (yik3s)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.