From: danielk1977 Date: Mon, 22 Nov 2004 13:35:41 +0000 (+0000) Subject: Ensure tests pass when SQLITE_OMIT_COMPOUND_SELECT is defined. (CVS 2138) X-Git-Tag: version-3.6.10~4014 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27c774388a190ceb6238f0c817e0abfefbe6853a;p=thirdparty%2Fsqlite.git Ensure tests pass when SQLITE_OMIT_COMPOUND_SELECT is defined. (CVS 2138) FossilOrigin-Name: 007be591b7829f9ff38e4b14ba5a5043796c2ff3 --- diff --git a/manifest b/manifest index 2182599ff9..c754466249 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\stests\spass\swhen\sSQLITE_OMIT_TRIGGER\sis\sdefined.\s(CVS\s2137) -D 2004-11-22T11:51:13 +C Ensure\stests\spass\swhen\sSQLITE_OMIT_COMPOUND_SELECT\sis\sdefined.\s(CVS\s2138) +D 2004-11-22T13:35:41 F Makefile.in 8291610f5839939a5fbff4dbbf85adb0fe1ac37f F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -74,7 +74,7 @@ F src/trigger.c 0c91b56182560263733e4b035acdb939bd1cf0e2 F src/update.c 24a605a4250fe4a0b173bedd7132d1892ad27090 F src/utf.c e45ce11be6922408cd381561721f6cca7d3b992a F src/util.c 4a8db4e97a3cfda12ad8dda3e77dd2d00ad1de5e -F src/vacuum.c d061dd908a9e809c54e40e24a551b1d64abd3d16 +F src/vacuum.c 705256e1111521fa04f0029de7f1667bc131d015 F src/vdbe.c ba3a920731d43bcf2497d558238400369008531a F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181 F src/vdbeInt.h 6017100adff362b8dfa37a69e3f1431f084bfa5b @@ -83,12 +83,12 @@ F src/vdbeaux.c dc06bbb8511d07f8d45ed2ea760f35f0736a690c F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0 F src/where.c f8a9e0bca6cb0a6fc4c189ed9fa771e75ad68bc8 F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c -F test/alter.test 2b4478c4906e4d1504b1a121b4ffbc8d11043b53 -F test/attach.test bb0ff048b0a65ca2bd5f186eee05d2ec084f3972 +F test/alter.test 2f0355d92bc360f897c0893f24cf4024e2719e56 +F test/attach.test a71117bab079c8a3a955e2d0270a76f9cb445935 F test/attach2.test 399128a7b3b209a339a8dbf53ca2ed42eb982d1a F test/attach3.test c05c70b933afbde0901dab9da3e66ee842c09f38 F test/auth.test 050fe904ab1b2654b0dbb776035833d64bcde3da -F test/autoinc.test 11330758197e0301d3600a071230d45b2f6a65b7 +F test/autoinc.test c071e51ff167b8e889212273588d9cca71845b70 F test/autovacuum.test a4e8da39a6268378c4f9fc17fe2df1d5be16d631 F test/autovacuum_crash.test 2dca85cbcc497098e45e8847c86407eb3554f3d4 F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f @@ -106,9 +106,9 @@ F test/capi3.test 3b33bf7c8836028835354c055989314e9c969c5c F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336 F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03 F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036 -F test/collate3.test cf747926374285c1690e3294a1abcb83d6f15529 +F test/collate3.test 5fe8077bd82c53112974f56f51f06cbd06d71374 F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b -F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5 +F test/collate5.test 7999fb3122386bae38acd8ccd61e0b7c5a30e289 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638 F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87 F test/corrupt.test 0080ddcece23e8ba47c44608c4fb73fd4d1d8ce2 @@ -128,32 +128,32 @@ F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a F test/index.test 1294997b4743007af57f8148c63ba14f07ad31ab F test/insert.test 56f9c20c9adc8d707490c4ffa5d4daa94826ea03 -F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a +F test/insert2.test 0bb50ff999e35a21549d8ee5dc44db8ac24d31a7 F test/interrupt.test 0aa230f8aedec0ad7caaf5edaced337e4cfb3820 F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194 F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c -F test/join.test 4bee854ef752619df9db2184eafe2f3a1561f74c +F test/join.test ea8c77b9fbc377fe553cdb5ce5f1bd72021dca5d F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8 F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93 F test/lastinsert.test b6a1db3e1ce2d3f0d6afe99d445084f543b6feaa F test/laststmtchanges.test 07cbdabc52407c29e40abc25050f2434f044a6b1 -F test/limit.test 4798e0196186e4c9b0f3ce90c1efd196877a1d17 +F test/limit.test c7bddad249631ad068fbbd0ab926e04ba7e3b9a2 F test/lock.test 32fe28e5030f25f23bcf6beef440675b0d848413 F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/main.test 5f9deae11b93336da1ccc5f91cf8be075c91ddf1 F test/malloc.test b4674cbb5a72b113eedaaf64fcd5c062e9957ded -F test/memdb.test c9ccd02cd9ce9d2cdcd5a712efecf24e7b93b7fa +F test/memdb.test 532aac7128a3da494cddc4461d76c6e3988f771b F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29 -F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6 +F test/minmax.test e7048476940df0af11d0f2cf687572f557cd0b29 F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a -F test/misc2.test d3bea4b809efaa4319299e55c50ee987b4f6470c +F test/misc2.test a655f2453d8b96fedca93b70fab6719cb4e99faa F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94 -F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622 +F test/misc4.test c683ab8182172474c804b346f8a39ca786322250 F test/misuse.test 2d7c46160f7c214f761fc5d030684a37ae8832a6 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 -F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b +F test/null.test 5a945790ef21b24fd602fe2c7a23847b903f8687 F test/pager.test 394455707a079804e8a4e431d12edce831a065f0 F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e F test/pager3.test 647f696a9cf7409df00a1e0047c2eb55585a1b85 @@ -166,15 +166,15 @@ F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62 F test/reindex.test 3552c6b944a3fab28cfd3049c04c65cb79419757 F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8 -F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f +F test/select1.test 524d4323f3921db16138f8b1765f1cc44e030bf4 F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685 -F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2 +F test/select4.test 1ae6f2bd6177d4428df8644eb95d09f4568fb149 F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5 -F test/select6.test 4ce9fa563662d5b2f5a8ff57e4d8b2f5cd186d38 -F test/select7.test 9dc9aaa403b14689e2cb9912c8f15e5ae8d104f7 -F test/sort.test 03e16f0c4d7fe7b7d87893db0cab3b399b8f2cb1 -F test/subselect.test 50f98723f00e97b1839d36410ee63597ca82d775 +F test/select6.test fe1c2bfb6921f26468424709bd1427122fb4d494 +F test/select7.test b952604c22a5644a065e9e99dc904b5a65565f07 +F test/sort.test 87882e6c72a75d45e98a1c802c1ded0eac557d85 +F test/subselect.test ff3850d0aab1443dafa4ecbdab1d01e58e7b366d F test/table.test 87a6219c784722249a2f604b6495ce171ca2588a F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede F test/tclsqlite.test 5e262df81a638a058536fb6d6666f316843ac7b2 @@ -185,7 +185,7 @@ F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b F test/trace.test a54fa8df0d01cf827289a7659d78959e8fd2f955 F test/trans.test 29645b344d2b9b6792793562b12340177ddd8f96 -F test/trigger1.test 65ee61f6a0f9e61badbd620ec17979ceb391efa1 +F test/trigger1.test 0c60435fb26db41bb2feb9549119e80857decdf1 F test/trigger2.test 534390be509127859fee7c23018f03b9bf21a88f F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2 F test/trigger4.test e7c0812b14750754602468f15495260e8c6625e0 @@ -197,7 +197,7 @@ F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217 F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558 F test/vacuum.test f18eccdee5b538d46298c64d6a060cfbf97bbc23 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 -F test/view.test a68bee7f5b4e33656667cbf4748dcfc5ebe1828b +F test/view.test 3f96df86f1c61ee850b945204683773bbbb8643e F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/lemon.c 250b30bcf3f1f422a2cad24b1597314777058a4b @@ -259,7 +259,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c -P 48c7eb7fb9fbc2166aaa7dbdb7c7e92c68f8eff3 -R 6dd508c54c10bef1b7e595fe1d4a4547 +P 53894988ac1ad44ec65a1e1c420e2a26eb4c2efd +R ae883046a665a42e48d31753b3268782 U danielk1977 -Z 55588ca2d1f74953c8ec1f40672d9644 +Z a08446cec18a32e6982c35ed9dfce9a2 diff --git a/manifest.uuid b/manifest.uuid index 739b3ae23c..595e47d8b8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -53894988ac1ad44ec65a1e1c420e2a26eb4c2efd \ No newline at end of file +007be591b7829f9ff38e4b14ba5a5043796c2ff3 \ No newline at end of file diff --git a/src/vacuum.c b/src/vacuum.c index b92b33d8f6..62fabfb4b5 100644 --- a/src/vacuum.c +++ b/src/vacuum.c @@ -14,7 +14,7 @@ ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** -** $Id: vacuum.c,v 1.34 2004/11/20 19:18:56 drh Exp $ +** $Id: vacuum.c,v 1.35 2004/11/22 13:35:41 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -175,14 +175,17 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ */ rc = execExecSql(db, "SELECT 'CREATE TABLE vacuum_db.' || substr(sql,14,100000000) " - " FROM sqlite_master WHERE type='table' " - "UNION ALL " - "SELECT 'CREATE INDEX vacuum_db.' || substr(sql,14,100000000) " - " FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' " - "UNION ALL " + " FROM sqlite_master WHERE type='table'"); + if( rc!=SQLITE_OK ) goto end_of_vacuum; + rc = execExecSql(db, + "SELECT 'CREATE INDEX vacuum_db.' || substr(sql,14,100000000)" + " FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' "); + if( rc!=SQLITE_OK ) goto end_of_vacuum; + rc = execExecSql(db, "SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21,100000000) " - " FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'" - "UNION ALL " + " FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'"); + if( rc!=SQLITE_OK ) goto end_of_vacuum; + rc = execExecSql(db, "SELECT 'CREATE VIEW vacuum_db.' || substr(sql,13,100000000) " " FROM sqlite_master WHERE type='view'" ); diff --git a/test/alter.test b/test/alter.test index b8acf52870..1781690a8d 100644 --- a/test/alter.test +++ b/test/alter.test @@ -8,7 +8,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the ALTER TABLE statement. # -# $Id: alter.test,v 1.6 2004/11/19 08:41:34 danielk1977 Exp $ +# $Id: alter.test,v 1.7 2004/11/22 13:35:42 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -53,19 +53,18 @@ do_test alter-1.1 { INSERT INTO [temp table] VALUES(5,6,7); } execsql { - SELECT 't1', * FROM t1 - UNION ALL - SELECT 't1''x1', * FROM "t1'x1" - UNION ALL - SELECT * FROM [temp table] + SELECT 't1', * FROM t1; + SELECT 't1''x1', * FROM "t1'x1"; + SELECT * FROM [temp table]; } } {t1 1 2 t1'x1 3 4 5 6 7} do_test alter-1.2 { execsql { - SELECT type, name, tbl_name FROM sqlite_master - UNION ALL - SELECT type, name, tbl_name FROM sqlite_temp_master - ORDER BY tbl_name, type desc, name + CREATE TEMP TABLE objlist(type, name, tbl_name); + INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; + INSERT INTO objlist + SELECT type, name, tbl_name FROM sqlite_temp_master WHERE NAME!='objlist'; + SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name; } } [list \ table t1 t1 \ @@ -92,19 +91,18 @@ do_test alter-1.3 { integrity_check alter-1.3.1 do_test alter-1.4 { execsql { - SELECT 't1', * FROM [-t1-] - UNION ALL - SELECT 't2', * FROM t2 - UNION ALL - SELECT * FROM temptab + SELECT 't1', * FROM [-t1-]; + SELECT 't2', * FROM t2; + SELECT * FROM temptab; } } {t1 1 2 t2 3 4 5 6 7} do_test alter-1.5 { execsql { - SELECT type, name, tbl_name FROM sqlite_master - UNION ALL - SELECT type, name, tbl_name FROM sqlite_temp_master - ORDER BY tbl_name, type desc, name + DELETE FROM objlist; + INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; + INSERT INTO objlist + SELECT type, name, tbl_name FROM sqlite_temp_master WHERE NAME!='objlist'; + SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name; } } [list \ table -t1- -t1- \ @@ -126,10 +124,13 @@ do_test alter-1.6 { db close set DB [sqlite3 db test.db] execsql { - SELECT type, name, tbl_name FROM sqlite_master - UNION ALL - SELECT type, name, tbl_name FROM sqlite_temp_master - ORDER BY tbl_name, type desc, name + CREATE TEMP TABLE objlist(type, name, tbl_name); + INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; + INSERT INTO objlist + SELECT type, name, tbl_name FROM sqlite_temp_master + WHERE NAME!='objlist'; + SELECT type, name, tbl_name FROM objlist + ORDER BY tbl_name, type desc, name; } } [list \ table -t1- -t1- \ @@ -150,10 +151,13 @@ do_test alter-1.7 { ALTER TABLE T2 RENAME TO []; } execsql { - SELECT type, name, tbl_name FROM sqlite_master - UNION ALL - SELECT type, name, tbl_name FROM sqlite_temp_master - ORDER BY tbl_name, type desc, name + DELETE FROM objlist; + INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; + INSERT INTO objlist + SELECT type, name, tbl_name FROM sqlite_temp_master + WHERE NAME!='objlist'; + SELECT type, name, tbl_name FROM objlist + ORDER BY tbl_name, type desc, name; } } [list \ table *t1* *t1* \ diff --git a/test/attach.test b/test/attach.test index 100e77c6dd..b9de77b93b 100644 --- a/test/attach.test +++ b/test/attach.test @@ -12,7 +12,7 @@ # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # -# $Id: attach.test,v 1.30 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: attach.test,v 1.31 2004/11/22 13:35:42 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -505,6 +505,7 @@ ifcapable {!trigger} { # fail and the query will abort but we will have already output some # results. When the query is retried, the results will be repeated. # +ifcapable compound { do_test attach-4.8 { execsql { ATTACH DATABASE 'test2.db' AS db2; @@ -520,6 +521,16 @@ do_test attach-4.9 { SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4; } } {db2.6 db2.13 main.11 main.15} +} ;# ifcapable compound + +ifcapable !compound { + ifcapable {!trigger} {execsql {INSERT INTO main.t4 VALUES('main.15')}} + execsql { + ATTACH DATABASE 'test2.db' AS db2; + INSERT INTO db2.t3 VALUES(13,14); + INSERT INTO main.t3 VALUES(15,16); + } +} ;# ifcapable !compound ifcapable view { do_test attach-4.10 { diff --git a/test/autoinc.test b/test/autoinc.test index ef99f8537c..bd330233f2 100644 --- a/test/autoinc.test +++ b/test/autoinc.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the AUTOINCREMENT features. # -# $Id: autoinc.test,v 1.1 2004/11/13 03:48:07 drh Exp $ +# $Id: autoinc.test,v 1.2 2004/11/22 13:35:42 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -328,25 +328,22 @@ do_test autoinc-3.4 { # do_test autoinc-4.1 { execsql { - SELECT 1, name FROM sqlite_master WHERE type='table' - UNION ALL - SELECT 2, name FROM sqlite_temp_master WHERE type='table' + SELECT 1, name FROM sqlite_master WHERE type='table'; + SELECT 2, name FROM sqlite_temp_master WHERE type='table'; } } {1 sqlite_sequence} do_test autoinc-4.2 { execsql { CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y); CREATE TEMP TABLE t3(a INTEGER PRIMARY KEY AUTOINCREMENT, b); - SELECT 1, name FROM sqlite_master WHERE type='table' - UNION ALL - SELECT 2, name FROM sqlite_temp_master WHERE type='table' + SELECT 1, name FROM sqlite_master WHERE type='table'; + SELECT 2, name FROM sqlite_temp_master WHERE type='table'; } } {1 sqlite_sequence 1 t1 2 t3 2 sqlite_sequence} do_test autoinc-4.3 { execsql { - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {} do_test autoinc-4.4 { @@ -355,38 +352,42 @@ do_test autoinc-4.4 { INSERT INTO t3 VALUES(20,2); INSERT INTO t1 VALUES(NULL,3); INSERT INTO t3 VALUES(NULL,4); + } +} {} + +ifcapable compound { +do_test autoinc-4.4.1 { + execsql { SELECT * FROM t1 UNION ALL SELECT * FROM t3; } } {10 1 11 3 20 2 21 4} +} ;# ifcapable compound + do_test autoinc-4.5 { execsql { - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {1 t1 11 2 t3 21} do_test autoinc-4.6 { execsql { INSERT INTO t1 SELECT * FROM t3; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {1 t1 21 2 t3 21} do_test autoinc-4.7 { execsql { INSERT INTO t3 SELECT x+100, y FROM t1; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {1 t1 21 2 t3 121} do_test autoinc-4.8 { execsql { DROP TABLE t3; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {1 t1 21} do_test autoinc-4.9 { @@ -394,17 +395,15 @@ do_test autoinc-4.9 { CREATE TEMP TABLE t2(p INTEGER PRIMARY KEY AUTOINCREMENT, q); INSERT INTO t2 SELECT * FROM t1; DROP TABLE t1; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {2 t2 21} do_test autoinc-4.10 { execsql { DROP TABLE t2; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; } } {} @@ -420,21 +419,17 @@ do_test autoinc-5.1 { } db2; execsql { ATTACH 'test2.db' as aux; - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence - UNION ALL - SELECT 3, * FROM aux.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; + SELECT 3, * FROM aux.sqlite_sequence; } } {} do_test autoinc-5.2 { execsql { INSERT INTO t4 VALUES(NULL,1); - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence - UNION ALL - SELECT 3, * FROM aux.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; + SELECT 3, * FROM aux.sqlite_sequence; } } {3 t4 1} do_test autoinc-5.3 { @@ -445,11 +440,9 @@ do_test autoinc-5.3 { } {t4 1 t5 200} do_test autoinc-5.4 { execsql { - SELECT 1, * FROM main.sqlite_sequence - UNION ALL - SELECT 2, * FROM temp.sqlite_sequence - UNION ALL - SELECT 3, * FROM aux.sqlite_sequence + SELECT 1, * FROM main.sqlite_sequence; + SELECT 2, * FROM temp.sqlite_sequence; + SELECT 3, * FROM aux.sqlite_sequence; } } {3 t4 1 3 t5 200} diff --git a/test/collate3.test b/test/collate3.test index 597ce9ff55..df88eb6ed5 100644 --- a/test/collate3.test +++ b/test/collate3.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is page cache subsystem. # -# $Id: collate3.test,v 1.5 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: collate3.test,v 1.6 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -120,6 +120,7 @@ do_test collate3-2.8 { } } {1 {no such collation sequence: string_compare}} +ifcapable compound { do_test collate3-2.9 { catchsql { SELECT c1 FROM collate3t1 UNION SELECT c1 FROM collate3t1; @@ -165,6 +166,7 @@ do_test collate3-2.17 { SELECT c1 FROM collate3t1 UNION ALL SELECT c1 FROM collate3t1 ORDER BY 1; } } {1 {no such collation sequence: string_compare}} +} ;# ifcapable compound # # Create an index that uses a collation sequence then close and diff --git a/test/collate5.test b/test/collate5.test index 8c8a65407f..7145ab6757 100644 --- a/test/collate5.test +++ b/test/collate5.test @@ -14,7 +14,7 @@ # SELECT statements that use user-defined collation sequences. Also # GROUP BY clauses that use user-defined collation sequences. # -# $Id: collate5.test,v 1.1 2004/06/11 10:51:41 danielk1977 Exp $ +# $Id: collate5.test,v 1.2 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -69,6 +69,13 @@ do_test collate5-1.3 { } } {a apple A Apple b banana n {}} +# The remainder of this file tests compound SELECT statements. +# Omit it if the library is compiled such that they are omitted. +# +ifcapable !compound { + finish_test + return +} # # Tests named collate5-2.* focus on UNION, EXCEPT and INTERSECT diff --git a/test/insert2.test b/test/insert2.test index fbe4f617f8..cadefb57b0 100644 --- a/test/insert2.test +++ b/test/insert2.test @@ -12,7 +12,7 @@ # focus of this file is testing the INSERT statement that takes is # result from a SELECT. # -# $Id: insert2.test,v 1.12 2004/09/17 17:23:15 drh Exp $ +# $Id: insert2.test,v 1.13 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -44,6 +44,7 @@ do_test insert2-1.1.3 { execsql {SELECT * FROM t1 ORDER BY log} } {0 1 1 1 2 2 3 4 4 8 5 4} +ifcapable compound { do_test insert2-1.2.1 { catch {execsql {DROP TABLE t1}} execsql { @@ -73,6 +74,9 @@ do_test insert2-1.3.2 { SELECT * FROM t1 ORDER BY log; } } {1 1 2 2} +} ;# ifcapable compound +execsql {PRAGMA count_changes=off;} + do_test insert2-1.4 { catch {execsql {DROP TABLE t1}} set r [execsql { diff --git a/test/join.test b/test/join.test index 1748a04e8b..098b545135 100644 --- a/test/join.test +++ b/test/join.test @@ -12,7 +12,7 @@ # # This file implements tests for joins, including outer joins. # -# $Id: join.test,v 1.12 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: join.test,v 1.13 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -369,6 +369,7 @@ do_test join-8.3 { # Both queries should generate the same results so the answer should # be an empty set. # +ifcapable compound { do_test join-9.1 { execsql { BEGIN; @@ -393,5 +394,6 @@ do_test join-9.2 { } } {} } ;# ifcapable view +} ;# ifcapable compound finish_test diff --git a/test/limit.test b/test/limit.test index f71de21232..3292497ec2 100644 --- a/test/limit.test +++ b/test/limit.test @@ -12,7 +12,7 @@ # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # -# $Id: limit.test,v 1.17 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: limit.test,v 1.18 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -219,6 +219,7 @@ do_test limit-6.8 { # Make sure LIMIT works well with compound SELECT statements. # Ticket #393 # +ifcapable compound { do_test limit-7.1.1 { catchsql { SELECT x FROM t2 LIMIT 5 UNION ALL SELECT a FROM t6; @@ -295,6 +296,7 @@ do_test limit-7.12 { ORDER BY 1 DESC LIMIT 1 OFFSET 1; } } {30} +} ;# ifcapable compound # Tests for limit in conjunction with distinct. The distinct should # occur before both the limit and the offset. Ticket #749. diff --git a/test/memdb.test b/test/memdb.test index 63c5c952b0..3de7f13e16 100644 --- a/test/memdb.test +++ b/test/memdb.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is in-memory database backend. # -# $Id: memdb.test,v 1.11 2004/11/22 05:26:28 danielk1977 Exp $ +# $Id: memdb.test,v 1.12 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] @@ -273,11 +273,13 @@ do_test memdb-6.4 { SELECT * FROM t2; } } {1 2 1 2 3 2 3 4 1 4 5 4} +ifcapable compound { do_test memdb-6.5 { execsql { SELECT a FROM t2 UNION SELECT b FROM t2 ORDER BY 1; } } {1 2 3 4 5} +} ;# ifcapable compound do_test memdb-6.6 { execsql { CREATE INDEX i2 ON t2(c); diff --git a/test/minmax.test b/test/minmax.test index 6f4814f7fc..64a1a6fe96 100644 --- a/test/minmax.test +++ b/test/minmax.test @@ -13,7 +13,7 @@ # aggregate min() and max() functions and which are handled as # as a special case. # -# $Id: minmax.test,v 1.13 2004/08/20 18:34:20 drh Exp $ +# $Id: minmax.test,v 1.14 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -122,6 +122,7 @@ do_test minmax-3.3 { set sqlite_search_count } {0} +ifcapable compound { do_test minmax-4.1 { execsql { SELECT coalesce(min(x+0),-1), coalesce(max(x+0),-1) FROM @@ -142,6 +143,7 @@ do_test minmax-4.3 { GROUP BY y ORDER BY y; } } {1 1 1 2 2 3 3 4 5 4 8 9 5 5 6 6 0 1} +} ;# ifcapable compound # Make sure the min(x) and max(x) optimizations work on empty tables # including empty tables with indices. Ticket #296. @@ -261,6 +263,7 @@ do_test minmax-8.2 { # Ticket #658: Test the min()/max() optimization when the FROM clause # is a subquery. # +ifcapable compound { do_test minmax-9.1 { execsql { SELECT max(rowid) FROM ( @@ -275,6 +278,7 @@ do_test minmax-9.2 { ) } } {{}} +} ;# ifcapable compound # If there is a NULL in an aggregate max() or min(), ignore it. An # aggregate min() or max() will only return NULL if all values are NULL. diff --git a/test/misc2.test b/test/misc2.test index fca1358a40..4df15c1726 100644 --- a/test/misc2.test +++ b/test/misc2.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc2.test,v 1.16 2004/11/22 10:02:23 danielk1977 Exp $ +# $Id: misc2.test,v 1.17 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -40,6 +40,7 @@ do_test misc2-1.2 { # Make sure ROWID works on a view and a subquery. Ticket #364 # +ifcapable view { do_test misc2-2.1 { execsql { CREATE TABLE t1(a,b,c); @@ -49,7 +50,6 @@ do_test misc2-2.1 { SELECT rowid, * FROM (SELECT * FROM t1, t2); } } {{} 1 2 3 7 8 9} -ifcapable view { do_test misc2-2.2 { execsql { CREATE VIEW v1 AS SELECT * FROM t1, t2; diff --git a/test/misc4.test b/test/misc4.test index 1b0663281b..5e0a16ad16 100644 --- a/test/misc4.test +++ b/test/misc4.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc4.test,v 1.7 2004/10/19 16:40:59 drh Exp $ +# $Id: misc4.test,v 1.8 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -84,6 +84,7 @@ do_test misc4-2.4 { # Ticket #966 # +ifcapable compound { do_test misc4-3.1 { execsql { CREATE TABLE Table1(ID integer primary key, Value TEXT); @@ -96,6 +97,7 @@ do_test misc4-3.1 { ORDER BY 1, 2; } } {{} {} 1 x 1 z} +} ;# ifcapable compound finish_test diff --git a/test/null.test b/test/null.test index b62a7a2331..89d3eb2f10 100644 --- a/test/null.test +++ b/test/null.test @@ -144,11 +144,13 @@ do_test null-5.1 { # A UNION to two queries should treat NULL values # as distinct # +ifcapable compound { do_test null-6.1 { execsql { select b from t1 union select c from t1 order by c; } } {{} 0 1} +} ;# ifcapable compound # The UNIQUE constraint only applies to non-null values # diff --git a/test/select1.test b/test/select1.test index 73e652e2a5..d6bab3f657 100644 --- a/test/select1.test +++ b/test/select1.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # -# $Id: select1.test,v 1.36 2004/08/20 18:34:20 drh Exp $ +# $Id: select1.test,v 1.37 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -434,6 +434,8 @@ do_test select1-6.9 { ORDER BY A.f1, B.f1}} msg] lappend v $msg } {0 {A.f1 11 B.f1 11 A.f1 11 B.f1 33 A.f1 33 B.f1 11 A.f1 33 B.f1 33}} + +ifcapable compound { do_test select1-6.10 { set v [catch {execsql2 { SELECT f1 FROM test1 UNION SELECT f2 FROM test1 @@ -448,6 +450,7 @@ do_test select1-6.11 { }} msg] lappend v $msg } {0 {f2+100 11 f2+100 33 f2+100 122 f2+100 144}} +} ;#ifcapable compound do_test select1-7.1 { set v [catch {execsql { @@ -455,12 +458,14 @@ do_test select1-7.1 { }} msg] lappend v $msg } {1 {near ";": syntax error}} +ifcapable compound { do_test select1-7.2 { set v [catch {execsql { SELECT f1 FROM test1 UNION SELECT WHERE; }} msg] lappend v $msg } {1 {near "WHERE": syntax error}} +} ;# ifcapable compound do_test select1-7.3 { set v [catch {execsql {SELECT f1 FROM test1 as 'hi', test2 as}} msg] lappend v $msg @@ -713,38 +718,50 @@ do_test select1-12.4 { execsql { DELETE FROM t3; INSERT INTO t3 VALUES(1,2); + } +} {} + +ifcapable compound { +do_test select1-12.5 { + execsql { SELECT * FROM t3 UNION SELECT 3 AS 'a', 4 ORDER BY a; } } {1 2 3 4} -do_test select1-12.5 { + +do_test select1-12.6 { execsql { SELECT 3, 4 UNION SELECT * FROM t3; } } {1 2 3 4} -do_test select1-12.6 { +} ;# ifcapable compound + +do_test select1-12.7 { execsql { SELECT * FROM t3 WHERE a=(SELECT 1); } } {1 2} -do_test select1-12.7 { +do_test select1-12.8 { execsql { SELECT * FROM t3 WHERE a=(SELECT 2); } } {} -do_test select1-12.8 { + +ifcapable compound { +do_test select1-12.9 { execsql2 { SELECT x FROM ( SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b ) ORDER BY x; } } {x 1 x 3} -do_test select1-12.9 { +do_test select1-12.10 { execsql2 { SELECT z.x FROM ( SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b ) AS 'z' ORDER BY x; } } {z.x 1 z.x 3} +} ;# ifcapable compound finish_test diff --git a/test/select4.test b/test/select4.test index 88f3eb6aff..423f352d28 100644 --- a/test/select4.test +++ b/test/select4.test @@ -12,11 +12,16 @@ # focus of this file is testing UNION, INTERSECT and EXCEPT operators # in SELECT statements. # -# $Id: select4.test,v 1.16 2004/05/27 17:22:56 drh Exp $ +# $Id: select4.test,v 1.17 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +# Most tests in this file depend on compound-select. But there are a couple +# right at the end that test DISTINCT, so we cannot omit the entire file. +# +ifcapable compound { + # Build some test data # execsql { @@ -468,6 +473,8 @@ do_test select4-7.4 { } } {n 1 log 0 n 2 log 1} +} ;# ifcapable compound + # Make sure DISTINCT works appropriately on TEXT and NUMERIC columns. do_test select4-8.1 { execsql { diff --git a/test/select6.test b/test/select6.test index 7e2af8a67f..d07a2c189d 100644 --- a/test/select6.test +++ b/test/select6.test @@ -12,7 +12,7 @@ # focus of this file is testing SELECT statements that contain # subqueries in their FROM clause. # -# $Id: select6.test,v 1.13 2004/11/03 16:27:02 drh Exp $ +# $Id: select6.test,v 1.14 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -294,6 +294,7 @@ do_test select6-5.2 { # Tests of compound sub-selects # +ifcapable compound { do_test select5-6.1 { execsql { DELETE FROM t1 WHERE x>4; @@ -335,6 +336,7 @@ do_test select6-6.6 { ) ORDER BY a; } } {1 3} +} ;# ifcapable compound # Subselects with no FROM clause # diff --git a/test/select7.test b/test/select7.test index 74a39df30e..e3b8bcc7a0 100644 --- a/test/select7.test +++ b/test/select7.test @@ -10,12 +10,14 @@ # focus of this file is testing compute SELECT statements and nested # views. # -# $Id: select7.test,v 1.2 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: select7.test,v 1.3 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable compound { + # A 3-way INTERSECT. Ticket #875 do_test select7-1.1 { execsql { @@ -48,5 +50,7 @@ do_test select7-2.1 { } {1 1} } ;# ifcapable view +} ;# ifcapable compound + finish_test diff --git a/test/sort.test b/test/sort.test index b7d7ce4d26..ae38416e92 100644 --- a/test/sort.test +++ b/test/sort.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # -# $Id: sort.test,v 1.17 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: sort.test,v 1.18 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -296,6 +296,8 @@ do_test sort-7.4 { SELECT b FROM v4 ORDER BY 1; } } {1 11 12 2} + +ifcapable compound { do_test sort-7.5 { execsql { SELECT a FROM t4 UNION SELECT a FROM v4 ORDER BY 1; @@ -316,6 +318,7 @@ do_test sort-7.8 { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1; } } {1 11 12 2} +} ;# ifcapable compound } ;# ifcapable view #### Version 3 works differently here: diff --git a/test/subselect.test b/test/subselect.test index 46d63d9c3a..a11f6bc448 100644 --- a/test/subselect.test +++ b/test/subselect.test @@ -12,7 +12,7 @@ # focus of this file is testing SELECT statements that are part of # expressions. # -# $Id: subselect.test,v 1.10 2004/08/20 18:34:20 drh Exp $ +# $Id: subselect.test,v 1.11 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -102,6 +102,7 @@ do_test subselect-2.3 { # Verify that the ORDER BY clause is honored in a subquery. # +ifcapable compound { do_test subselect-3.1 { execsql { CREATE TABLE t3(x int); @@ -109,6 +110,18 @@ do_test subselect-3.1 { SELECT * FROM t3 ORDER BY x; } } {1 2 3 4 5 6} +} ;# ifcapable compound +ifcapable !compound { +do_test subselect-3.1 { + execsql { + CREATE TABLE t3(x int); + INSERT INTO t3 SELECT a FROM t1; + INSERT INTO t3 SELECT b FROM t1; + SELECT * FROM t3 ORDER BY x; + } +} {1 2 3 4 5 6} +} ;# ifcapable !compound + do_test subselect-3.2 { execsql { SELECT sum(x) FROM (SELECT x FROM t3 ORDER BY x LIMIT 2); diff --git a/test/trigger1.test b/test/trigger1.test index 304750a458..dc7ebd1575 100644 --- a/test/trigger1.test +++ b/test/trigger1.test @@ -266,6 +266,10 @@ do_test trigger-3.7 { SELECT * FROM t2; } } {} + +# There are two versions of trigger-3.8 and trigger-3.9. One that uses +# compound SELECT statements, and another that does not. +ifcapable compound { do_test trigger-3.8 { execsql { INSERT INTO t1 VALUES(3,4); @@ -280,6 +284,25 @@ do_test trigger-3.9 { SELECT * FROM t1 UNION ALL SELECT * FROM t2; } } {1 2 3 4 5 6 3 4} +} ;# ifcapable compound +ifcapable !compound { +do_test trigger-3.8 { + execsql { + INSERT INTO t1 VALUES(3,4); + SELECT * FROM t1; + SELECT * FROM t2; + } +} {1 2 3 4 3 4} +do_test trigger-3.9 { + db close + sqlite3 db test.db + execsql { + INSERT INTO t1 VALUES(5,6); + SELECT * FROM t1; + SELECT * FROM t2; + } +} {1 2 3 4 5 6 3 4} +} ;# ifcapable !compound do_test trigger-4.1 { execsql { @@ -405,6 +428,9 @@ do_test trigger-8.6 { # Make sure REPLACE works inside of triggers. # +# There are two versions of trigger-9.1 and trigger-9.2. One that uses +# compound SELECT statements, and another that does not. +ifcapable compound { do_test trigger-9.1 { execsql { CREATE TABLE t3(a,b); @@ -422,6 +448,26 @@ do_test trigger-9.2 { SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; } } {1 2 1 3 99 99 1 3} +} +ifcapable !compound { +do_test trigger-9.1 { + execsql { + CREATE TABLE t3(a,b); + CREATE TABLE t4(x UNIQUE, b); + CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN + REPLACE INTO t4 VALUES(new.a,new.b); + END; + INSERT INTO t3 VALUES(1,2); + SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4; + } +} {1 2 99 99 1 2} +do_test trigger-9.2 { + execsql { + INSERT INTO t3 VALUES(1,3); + SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4; + } +} {1 2 1 3 99 99 1 3} +} execsql { DROP TABLE t2; diff --git a/test/view.test b/test/view.test index 21a97af4f1..d39b6e40b7 100644 --- a/test/view.test +++ b/test/view.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # -# $Id: view.test,v 1.20 2004/11/22 08:43:32 danielk1977 Exp $ +# $Id: view.test,v 1.21 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -146,6 +146,8 @@ do_test view-3.3 { SELECT * FROM v1 LIMIT 1 } } {xyz 2 pqr 7 c-b 1} + +ifcapable compound { do_test view-3.4 { execsql2 { CREATE VIEW v3 AS SELECT a FROM t1 UNION SELECT b FROM t1 ORDER BY b; @@ -162,6 +164,7 @@ do_test view-3.5 { SELECT y FROM v4 ORDER BY y LIMIT 4; } } {y 2 y 3 y 5 y 6} +} ;# ifcapable compound do_test view-4.1 {