summaryrefslogtreecommitdiff
path: root/test/distinct.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/distinct.test')
-rw-r--r--test/distinct.test29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/distinct.test b/test/distinct.test
index fcbe4e6..78c2c1d 100644
--- a/test/distinct.test
+++ b/test/distinct.test
@@ -162,10 +162,10 @@ do_execsql_test 2.0 {
foreach {tn sql temptables res} {
1 "a, b FROM t1" {} {A B a b}
2 "b, a FROM t1" {} {B A b a}
- 3 "a, b, c FROM t1" {hash} {a b c A B C}
+ 3 "a, b, c FROM t1" {hash} {A B C a b c}
4 "a, b, c FROM t1 ORDER BY a, b, c" {btree} {A B C a b c}
5 "b FROM t1 WHERE a = 'a'" {} {b}
- 6 "b FROM t1" {hash} {b B}
+ 6 "b FROM t1 ORDER BY +b COLLATE binary" {btree hash} {B b}
7 "a FROM t1" {} {A a}
8 "b COLLATE nocase FROM t1" {} {b}
9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {b}
@@ -197,4 +197,29 @@ do_test 3.1 {
}]
} {0}
+#-------------------------------------------------------------------------
+# Ticket [fccbde530a6583bf2748400919f1603d5425995c] (2014-01-08)
+# The logic that computes DISTINCT sometimes thinks that a zeroblob()
+# and a blob of all zeros are different when they should be the same.
+#
+do_execsql_test 4.1 {
+ DROP TABLE IF EXISTS t1;
+ DROP TABLE IF EXISTS t2;
+ CREATE TABLE t1(a INTEGER);
+ INSERT INTO t1 VALUES(3);
+ INSERT INTO t1 VALUES(2);
+ INSERT INTO t1 VALUES(1);
+ INSERT INTO t1 VALUES(2);
+ INSERT INTO t1 VALUES(3);
+ INSERT INTO t1 VALUES(1);
+ CREATE TABLE t2(x);
+ INSERT INTO t2
+ SELECT DISTINCT
+ CASE a WHEN 1 THEN x'0000000000'
+ WHEN 2 THEN zeroblob(5)
+ ELSE 'xyzzy' END
+ FROM t1;
+ SELECT quote(x) FROM t2 ORDER BY 1;
+} {'xyzzy' X'0000000000'}
+
finish_test