COLLATE clause in ORDER BY causes incorrect EXCEPT
|User & Date:||drh 2013-05-06 15:21:16|
- Change foundin to "188.8.131.52"
- Change icomment to:
In the code shown below (which is intended to be run from the sqlite3.exe command-line tool) the three SELECT statements should all generate the same answer. But the third one does not. It is as if the COLLATE clause on the ORDER BY somehow got pulled into the EXCEPT operator. Note that the ".print" commands are instructions to the sqlite3.exe shell program to output delimiter lines so that you can more easily tell where the output of one query ends and the next query begins. <blockquote><verbatim> CREATE TABLE t1(a); INSERT INTO t1 VALUES('abc'),('def'); CREATE TABLE t2(a); INSERT INTO t2 VALUES('DEF'); SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a; .print ----- SELECT a FROM (SELECT a FROM t1 EXCEPT SELECT a FROM t2) ORDER BY a COLLATE nocase; .print ----- SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a COLLATE nocase; </verbatim></blockquote> Bisecting shows that this problem was introduced in SQLite version 3.6.0 by check-in [8bbfa97837a74ef] on 2008-06-15.
- Change login to "drh"
- Change mimetype to "text/x-fossil-wiki"
- Change severity to "Severe"
- Change status to "Open"
- Change title to "COLLATE clause in ORDER BY causes incorrect EXCEPT"
- Change type to "Code_Defect"