sl@0: # sl@0: # 2007 May 28 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # $Id: tkt2391.test,v 1.1 2007/05/29 12:11:30 danielk1977 Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: do_test tkt2391.1 { sl@0: execsql { sl@0: CREATE TABLE folders(folderid, parentid, foldername COLLATE binary); sl@0: INSERT INTO folders VALUES(1, 3, 'FolderA'); sl@0: INSERT INTO folders VALUES(1, 3, 'folderB'); sl@0: INSERT INTO folders VALUES(4, 0, 'FolderC'); sl@0: } sl@0: } {} sl@0: sl@0: do_test tkt2391.2 { sl@0: execsql { sl@0: SELECT count(*) FROM folders WHERE foldername < 'FolderC'; sl@0: } sl@0: } {1} sl@0: sl@0: do_test tkt2391.3 { sl@0: execsql { sl@0: SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase; sl@0: } sl@0: } {2} sl@0: sl@0: # This demonstrates the bug. Creating the index causes SQLite to ignore sl@0: # the "COLLATE nocase" clause and use the default collation sequence sl@0: # for column "foldername" instead (happens to be BINARY in this case). sl@0: # sl@0: do_test tkt2391.4 { sl@0: execsql { sl@0: CREATE INDEX f_i ON folders(foldername); sl@0: SELECT count(*) FROM folders WHERE foldername < 'FolderC' COLLATE nocase; sl@0: } sl@0: } {2} sl@0: sl@0: finish_test