summaryrefslogtreecommitdiff
path: root/test/orderby4.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
committerHans-Christoph Steiner <hans@eds.org>2013-08-13 15:43:01 -0400
commit4228998fd796fa2f9e84fb73632e0a07cc7cd188 (patch)
tree15b2336f351468fedd0c39e9de4ad905a686f3b0 /test/orderby4.test
parentbdee7cf7d974b2f70d5934786c5666006e7360be (diff)
parent08119c361d1181b3e8f1abb429236e488a664753 (diff)
Merge tag 'upstream/2.2.1'
Upstream version 2.2.1 # gpg: Signature made Tue 13 Aug 2013 03:42:56 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]" # gpg: aka "Hans-Christoph Steiner <hs420@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hansi@nyu.edu>" # gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>"
Diffstat (limited to 'test/orderby4.test')
-rw-r--r--test/orderby4.test56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/orderby4.test b/test/orderby4.test
new file mode 100644
index 0000000..ec6eb04
--- /dev/null
+++ b/test/orderby4.test
@@ -0,0 +1,56 @@
+# 2013 March 26
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing that the optimizations that disable
+# ORDER BY clauses work correctly on multi-value primary keys and
+# unique indices when only some prefix of the terms in the key are
+# used. See ticket http://www.sqlite.org/src/info/a179fe74659
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix orderby4
+
+# Generate test data for a join. Verify that the join gets the
+# correct answer.
+#
+do_execsql_test 1.1 {
+ CREATE TABLE t1(a, b, PRIMARY KEY(a,b));
+ INSERT INTO t1 VALUES(1,1),(1,2);
+ CREATE TABLE t2(x, y, PRIMARY KEY(x,y));
+ INSERT INTO t2 VALUES(3,3),(4,4);
+ SELECT a, x FROM t1, t2 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+do_execsql_test 1.2 {
+ SELECT a, x FROM t1 CROSS JOIN t2 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+do_execsql_test 1.3 {
+ SELECT a, x FROM t2 CROSS JOIN t1 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+
+do_execsql_test 2.1 {
+ CREATE TABLE t3(a);
+ INSERT INTO t3 VALUES(1),(1);
+ CREATE INDEX t3a ON t3(a);
+ CREATE TABLE t4(x);
+ INSERT INTO t4 VALUES(3),(4);
+ CREATE INDEX t4x ON t4(x);
+ SELECT a, x FROM t3, t4 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+do_execsql_test 2.2 {
+ SELECT a, x FROM t3 CROSS JOIN t4 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+do_execsql_test 2.3 {
+ SELECT a, x FROM t4 CROSS JOIN t3 ORDER BY 1, 2;
+} {1 3 1 3 1 4 1 4}
+
+finish_test