CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
orderby4.test57 linesDownload Raw Back to test
1# 2013 March 262#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11# This file implements regression tests for SQLite library.  The12# focus of this file is testing that the optimizations that disable13# ORDER BY clauses work correctly on multi-value primary keys and14# unique indices when only some prefix of the terms in the key are15# used.  See ticket http://sqlite.org/src/info/a179fe7465916#17 18 19set testdir [file dirname $argv0]20source $testdir/tester.tcl21set ::testprefix orderby422 23# Generate test data for a join.  Verify that the join gets the24# correct answer.25#26do_execsql_test 1.1 {27  CREATE TABLE t1(a, b, PRIMARY KEY(a,b));28  INSERT INTO t1 VALUES(1,1),(1,2);29  CREATE TABLE t2(x, y, PRIMARY KEY(x,y));30  INSERT INTO t2 VALUES(3,3),(4,4);31  SELECT a, x FROM t1, t2 ORDER BY 1, 2;32} {1 3 1 3 1 4 1 4}33do_execsql_test 1.2 {34  SELECT a, x FROM t1 CROSS JOIN t2 ORDER BY 1, 2;35} {1 3 1 3 1 4 1 4}36do_execsql_test 1.3 {37  SELECT a, x FROM t2 CROSS JOIN t1 ORDER BY 1, 2;38} {1 3 1 3 1 4 1 4}39 40do_execsql_test 2.1 {41  CREATE TABLE t3(a);42  INSERT INTO t3 VALUES(1),(1);43  CREATE INDEX t3a ON t3(a);44  CREATE TABLE t4(x);45  INSERT INTO t4 VALUES(3),(4);46  CREATE INDEX t4x ON t4(x);47  SELECT a, x FROM t3, t4 ORDER BY 1, 2;48} {1 3 1 3 1 4 1 4}49do_execsql_test 2.2 {50  SELECT a, x FROM t3 CROSS JOIN t4 ORDER BY 1, 2;51} {1 3 1 3 1 4 1 4}52do_execsql_test 2.3 {53  SELECT a, x FROM t4 CROSS JOIN t3 ORDER BY 1, 2;54} {1 3 1 3 1 4 1 4}55 56finish_test57