summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/src/test/offset1.test
diff options
context:
space:
mode:
authorScott Hess <shess@chromium.org>2016-01-22 15:44:51 -0800
committerScott Hess <shess@chromium.org>2016-01-22 23:46:53 +0000
commite0b6a82cadecbda7e005921c2416fc7afb3542aa (patch)
tree7d0ea9c7455b3da063646c8ac885d70a61632ecc /third_party/sqlite/src/test/offset1.test
parent3b13f04b739480acc7d449ef5c4ba0157bb538b5 (diff)
downloadchromium_src-e0b6a82cadecbda7e005921c2416fc7afb3542aa.zip
chromium_src-e0b6a82cadecbda7e005921c2416fc7afb3542aa.tar.gz
chromium_src-e0b6a82cadecbda7e005921c2416fc7afb3542aa.tar.bz2
Import SQLite 3.10.2.
Ran through the import script in third_party/sqlite/README.Chromium, including the SQLite test suite. No new errors observed. SQLite changes are at http://www.sqlite.org/changes.html , Chromium previously used 3.8.7.4. All patches were applied and the results reviewed to make sure backported patches were safe to remove, and retained patches were still covering what was necessary. Keep fts4 disabled, and also the new fts3 virtual table and unicode61 tokenizer. Once enabled, these are very hard to disable, and there doesn't seem to be any pressure to enable them. Set SQLITE_DEFAULT_PCACHE_INITSZ to 0 so SQLite does not preallocate 100 pages to pcache (both so Chromium can manage memory, also because our code disables shared pcache). Other SQLITE_* flags were reviewed for applicability, none looked essential. BUG=579743 R=michaeln@chromium.org Review URL: https://codereview.chromium.org/1610963002 . Cr-Commit-Position: refs/heads/master@{#371085}
Diffstat (limited to 'third_party/sqlite/src/test/offset1.test')
-rw-r--r--third_party/sqlite/src/test/offset1.test161
1 files changed, 161 insertions, 0 deletions
diff --git a/third_party/sqlite/src/test/offset1.test b/third_party/sqlite/src/test/offset1.test
new file mode 100644
index 0000000..91dc0b0
--- /dev/null
+++ b/third_party/sqlite/src/test/offset1.test
@@ -0,0 +1,161 @@
+# 2015-10-06
+#
+# 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 test cases for the [b65cb2c8d91f6685841d7d1e13b6]
+# bug: Correct handling of LIMIT and OFFSET on a UNION ALL query where
+# the right-hand SELECT contains an ORDER BY in a subquery.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+ifcapable !compound {
+ finish_test
+ return
+}
+
+do_execsql_test offset1-1.1 {
+ CREATE TABLE t1(a,b);
+ INSERT INTO t1 VALUES(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
+ CREATE TABLE t2(x,y);
+ INSERT INTO t2 VALUES(8,'y'),(9,'z'),(6,'w'),(7,'x');
+ SELECT count(*) FROM t1, t2;
+} {20}
+
+do_execsql_test offset1-1.2.0 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 0;
+} {1 a 2 b 3 c}
+do_execsql_test offset1-1.2.1 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 1;
+} {2 b 3 c 4 d}
+do_execsql_test offset1-1.2.2 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 2;
+} {3 c 4 d 5 e}
+do_execsql_test offset1-1.2.3 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 3;
+} {4 d 5 e 6 w}
+do_execsql_test offset1-1.2.4 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 4;
+} {5 e 6 w 7 x}
+do_execsql_test offset1-1.2.5 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 5;
+} {6 w 7 x 8 y}
+do_execsql_test offset1-1.2.6 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 6;
+} {7 x 8 y 9 z}
+do_execsql_test offset1-1.2.7 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 7;
+} {8 y 9 z}
+do_execsql_test offset1-1.2.8 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 8;
+} {9 z}
+do_execsql_test offset1-1.2.9 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 9;
+} {}
+
+do_execsql_test offset1-1.3.0 {
+ SELECT * FROM t1 LIMIT 0;
+} {}
+
+do_execsql_test offset1-1.4.0 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 0 OFFSET 1;
+} {}
+do_execsql_test offset1-1.4.1 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 1 OFFSET 1;
+} {2 b}
+do_execsql_test offset1-1.4.2 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 2 OFFSET 1;
+} {2 b 3 c}
+do_execsql_test offset1-1.4.3 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 3 OFFSET 1;
+} {2 b 3 c 4 d}
+do_execsql_test offset1-1.4.4 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 4 OFFSET 1;
+} {2 b 3 c 4 d 5 e}
+do_execsql_test offset1-1.4.5 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 5 OFFSET 1;
+} {2 b 3 c 4 d 5 e 6 w}
+do_execsql_test offset1-1.4.6 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 6 OFFSET 1;
+} {2 b 3 c 4 d 5 e 6 w 7 x}
+do_execsql_test offset1-1.4.7 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 7 OFFSET 1;
+} {2 b 3 c 4 d 5 e 6 w 7 x 8 y}
+do_execsql_test offset1-1.4.8 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 8 OFFSET 1;
+} {2 b 3 c 4 d 5 e 6 w 7 x 8 y 9 z}
+do_execsql_test offset1-1.4.9 {
+ SELECT a, b FROM t1
+ UNION ALL
+ SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
+ LIMIT 9 OFFSET 1;
+} {2 b 3 c 4 d 5 e 6 w 7 x 8 y 9 z}
+
+
+
+finish_test