mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Additional test cases added. The following bug fixed: A segfault was occurring
if a VIEW consisted of a join with a USING clause. (CVS 651) FossilOrigin-Name: 96515b813eb57e1f48c28d357d1f38639b2fdcfa
This commit is contained in:
26
manifest
26
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sfor\sticket\s#84:\sIf\sthe\sWHERE\sclause\sis\stoo\scomplex,\sissue\san\serror\smessage\nand\srefuse\sto\sdo\sthe\sSELECT.\s\sThe\scutoff\sis\sa\sWHERE\sclause\swith\s100\sterms.\s(CVS\s650)
|
||||
D 2002-06-28T01:02:38
|
||||
C Additional\stest\scases\sadded.\s\sThe\sfollowing\sbug\sfixed:\sA\ssegfault\swas\soccurring\nif\sa\sVIEW\sconsisted\sof\sa\sjoin\swith\sa\sUSING\sclause.\s(CVS\s651)
|
||||
D 2002-06-28T12:18:47
|
||||
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
||||
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
|
||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||
@@ -20,10 +20,10 @@ F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
|
||||
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
|
||||
F src/btree.c 6aaa67d7eab70c2531dc13e5d9eb87e626c0b4d7
|
||||
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
||||
F src/build.c c288c2428ad34542d6357619f4c30d0a761fe55f
|
||||
F src/build.c 0834185cbe316dda5173de50886ed804b82e3ba6
|
||||
F src/delete.c 44c45460b1e03033756e35adc6d569ffbf30b725
|
||||
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
|
||||
F src/expr.c d49737db0c5b171b0a13204bcc09d1c9bc7daead
|
||||
F src/expr.c c5b8ee4d51df4de4ee51cadfd0123294e3d683d5
|
||||
F src/func.c 5eae8227a8b0d276a64d51a3880a6e86f238fedf
|
||||
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
|
||||
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
||||
@@ -37,11 +37,11 @@ F src/pager.h 6fddfddd3b73aa8abc081b973886320e3c614f0e
|
||||
F src/parse.y c75ea2580de675bcb80ff8b7c10c0a15e02a21ab
|
||||
F src/printf.c 236ed7a79386feed4456fa728fff8be793f1547c
|
||||
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
||||
F src/select.c 92ffd8b5ef96c801f469b658a13bcaa22b1bac13
|
||||
F src/select.c 473670ff00c30ffa92784a49766c522181239a9a
|
||||
F src/shell.c 0b06e4421ddf34f30263a2674abe768a2b5fd538
|
||||
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
||||
F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
|
||||
F src/sqliteInt.h 3d1d86cb9ea4f06e49af855267478e3661abcd1b
|
||||
F src/sqliteInt.h 0f2cca162fbb352ca53f97283dbafce31495dcce
|
||||
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
||||
F src/tclsqlite.c e932591c0bb522b0a35ea7dc861c623ccb2e3aa8
|
||||
F src/test1.c 29ed719d8ce890733fbeadb53cacc4e542d423ed
|
||||
@@ -54,13 +54,13 @@ F src/update.c 6f6a4dcd71cd9ff730b7f12c83de5498cde4924f
|
||||
F src/util.c 876b259f9186e84b944b72e793dd3dad50e63e95
|
||||
F src/vdbe.c 0c7783ba52b1bd9e40331937c32d3aa3351ff4a3
|
||||
F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
|
||||
F src/where.c e692b238fa0b45c159ab736da3fad2703800a0ca
|
||||
F src/where.c 6a43aa6c80eab12221eeca754cba852a9ecd1e13
|
||||
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
|
||||
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
|
||||
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
|
||||
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
|
||||
F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
|
||||
F test/conflict.test 93ac51097a2cd51c85b4b68aea8cb6c3933b491f
|
||||
F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
|
||||
F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
|
||||
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
|
||||
F test/expr.test c61a92f7d76d63d7379d58bc35245e156c9b63c3
|
||||
@@ -71,7 +71,7 @@ F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
||||
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
|
||||
F test/intpkey.test 69a6a9b41e541f27a2ffcd20264fb35adc3c2680
|
||||
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
|
||||
F test/join.test ea6a4097e4fcebbb16eac7ec819569e759336a74
|
||||
F test/join.test 89bd99545094c51a04c2582b014c4527c4d90119
|
||||
F test/limit.test 49b44e027a002c0ba336d723b448f07e05b04466
|
||||
F test/lock.test f1b55dc61632e99d241643cc8e7c03774f09f623
|
||||
F test/main.test c66b564554b770ee7fdbf6a66c0cd90329bc2c85
|
||||
@@ -107,7 +107,7 @@ F test/trigger3.test 7dfe798d7e72c13720394685fe353112e3f31adf
|
||||
F test/unique.test 572aa791327c1e8d797932263e9d67f176cfdb44
|
||||
F test/update.test a0aa0bf83e6fad8407d0e4ad25ebb09b513f5bf4
|
||||
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
|
||||
F test/view.test b9851e9142de5e5831fdf18f125cbe1256cb550a
|
||||
F test/view.test d3f178e9ea170c49b4049469f3d5a8eca97dd875
|
||||
F test/where.test 1f87bec674bf85d74ac1cc5b2cd3d89be1e87b1d
|
||||
F tool/lemon.c 459cb2bb3738a1ad5cb0ad8b805587a88a885d95
|
||||
F tool/lempar.c 73a991cc3017fb34804250fa901488b5147b3717
|
||||
@@ -137,7 +137,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
|
||||
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||
P 16552a7a29450a23765f0f05a9f4058638eafd74
|
||||
R 0b306828319c3c6ac72442b55b9bb1d4
|
||||
P c07e493b62125e85eaea36b6945f1e146e2792b8
|
||||
R 533eee0cd3864ec067733fb32b2f681d
|
||||
U drh
|
||||
Z cd2730365c5ef98d487b1c111506dfad
|
||||
Z 42e105a8fbfb4f79b6ee97023cbdbecf
|
||||
|
||||
@@ -1 +1 @@
|
||||
c07e493b62125e85eaea36b6945f1e146e2792b8
|
||||
96515b813eb57e1f48c28d357d1f38639b2fdcfa
|
||||
@@ -25,7 +25,7 @@
|
||||
** ROLLBACK
|
||||
** PRAGMA
|
||||
**
|
||||
** $Id: build.c,v 1.99 2002/06/25 13:16:03 drh Exp $
|
||||
** $Id: build.c,v 1.100 2002/06/28 12:18:47 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -898,6 +898,9 @@ int sqliteViewGetColumnNames(Parse *pParse, Table *pTable){
|
||||
**
|
||||
** CREATE VIEW one AS SELECT * FROM two;
|
||||
** CREATE VIEW two AS SELECT * FROM one;
|
||||
**
|
||||
** Actually, this error is caught previously and so the following test
|
||||
** should always fail. But we will leave it in place just to be safe.
|
||||
*/
|
||||
if( pTable->nCol<0 ){
|
||||
sqliteSetString(&pParse->zErrMsg, "view ", pTable->zName,
|
||||
|
||||
16
src/expr.c
16
src/expr.c
@@ -12,7 +12,7 @@
|
||||
** This file contains routines used for analyzing expressions and
|
||||
** for generating VDBE code that evaluates expressions in SQLite.
|
||||
**
|
||||
** $Id: expr.c,v 1.74 2002/06/26 02:45:04 drh Exp $
|
||||
** $Id: expr.c,v 1.75 2002/06/28 12:18:47 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -121,8 +121,10 @@ void sqliteExprDelete(Expr *p){
|
||||
*/
|
||||
void sqliteExprMoveStrings(Expr *p, int offset){
|
||||
if( p==0 ) return;
|
||||
if( p->token.z ) p->token.z += offset;
|
||||
if( p->span.z ) p->span.z += offset;
|
||||
if( !p->staticToken ){
|
||||
if( p->token.z ) p->token.z += offset;
|
||||
if( p->span.z ) p->span.z += offset;
|
||||
}
|
||||
if( p->pLeft ) sqliteExprMoveStrings(p->pLeft, offset);
|
||||
if( p->pRight ) sqliteExprMoveStrings(p->pRight, offset);
|
||||
if( p->pList ) sqliteExprListMoveStrings(p->pList, offset);
|
||||
@@ -166,16 +168,10 @@ Expr *sqliteExprDup(Expr *p){
|
||||
if( p==0 ) return 0;
|
||||
pNew = sqliteMalloc( sizeof(*p) );
|
||||
if( pNew==0 ) return 0;
|
||||
pNew->op = p->op;
|
||||
pNew->dataType = p->dataType;
|
||||
memcpy(pNew, p, sizeof(*pNew));
|
||||
pNew->pLeft = sqliteExprDup(p->pLeft);
|
||||
pNew->pRight = sqliteExprDup(p->pRight);
|
||||
pNew->pList = sqliteExprListDup(p->pList);
|
||||
pNew->iTable = p->iTable;
|
||||
pNew->iColumn = p->iColumn;
|
||||
pNew->iAgg = p->iAgg;
|
||||
pNew->token = p->token;
|
||||
pNew->span = p->span;
|
||||
pNew->pSelect = sqliteSelectDup(p->pSelect);
|
||||
return pNew;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements in SQLite.
|
||||
**
|
||||
** $Id: select.c,v 1.100 2002/06/26 02:45:04 drh Exp $
|
||||
** $Id: select.c,v 1.101 2002/06/28 12:18:47 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -157,13 +157,17 @@ static void addWhereTerm(
|
||||
dummy.z = zCol;
|
||||
dummy.n = strlen(zCol);
|
||||
pE1a = sqliteExpr(TK_ID, 0, 0, &dummy);
|
||||
pE1a->staticToken = 1;
|
||||
pE2a = sqliteExpr(TK_ID, 0, 0, &dummy);
|
||||
pE2a->staticToken = 1;
|
||||
dummy.z = pTab1->zName;
|
||||
dummy.n = strlen(dummy.z);
|
||||
pE1b = sqliteExpr(TK_ID, 0, 0, &dummy);
|
||||
pE1b->staticToken = 1;
|
||||
dummy.z = pTab2->zName;
|
||||
dummy.n = strlen(dummy.z);
|
||||
pE2b = sqliteExpr(TK_ID, 0, 0, &dummy);
|
||||
pE2b->staticToken = 1;
|
||||
pE1c = sqliteExpr(TK_DOT, pE1b, pE1a, 0);
|
||||
pE2c = sqliteExpr(TK_DOT, pE2b, pE2a, 0);
|
||||
pE = sqliteExpr(TK_EQ, pE1c, pE2c, 0);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** Internal interface definitions for SQLite.
|
||||
**
|
||||
** @(#) $Id: sqliteInt.h,v 1.131 2002/06/25 01:09:12 drh Exp $
|
||||
** @(#) $Id: sqliteInt.h,v 1.132 2002/06/28 12:18:47 drh Exp $
|
||||
*/
|
||||
#include "sqlite.h"
|
||||
#include "hash.h"
|
||||
@@ -432,6 +432,7 @@ struct Expr {
|
||||
u8 op; /* Operation performed by this node */
|
||||
u8 dataType; /* Either SQLITE_SO_TEXT or SQLITE_SO_NUM */
|
||||
u8 isJoinExpr; /* Origina is the ON or USING phrase of a join */
|
||||
u8 staticToken; /* Expr.token.z points to static memory */
|
||||
Expr *pLeft, *pRight; /* Left and right subnodes */
|
||||
ExprList *pList; /* A list of expressions used as function arguments
|
||||
** or in "<expr> IN (<expr-list)" */
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
** the WHERE clause of SQL statements. Also found here are subroutines
|
||||
** to generate VDBE code to evaluate expressions.
|
||||
**
|
||||
** $Id: where.c,v 1.57 2002/06/28 01:02:38 drh Exp $
|
||||
** $Id: where.c,v 1.58 2002/06/28 12:18:47 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1033,6 +1033,10 @@ WhereInfo *sqliteWhereBegin(
|
||||
if( aExpr[j].p==0 ) continue;
|
||||
if( (aExpr[j].prereqAll & loopMask)!=aExpr[j].prereqAll ) continue;
|
||||
if( haveKey ){
|
||||
/* Cannot happen. "haveKey" can only be true if pushKey is true
|
||||
** an pushKey can only be true for DELETE and UPDATE and there are
|
||||
** no outer joins with DELETE and UPDATE.
|
||||
*/
|
||||
haveKey = 0;
|
||||
sqliteVdbeAddOp(v, OP_MoveTo, base+idx, 0);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# This file implements tests for the conflict resolution extension
|
||||
# to SQLite.
|
||||
#
|
||||
# $Id: conflict.test,v 1.12 2002/06/25 13:16:04 drh Exp $
|
||||
# $Id: conflict.test,v 1.13 2002/06/28 12:18:48 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -491,6 +491,173 @@ do_test conflict-8.6.1 {
|
||||
db changes
|
||||
} {3}
|
||||
|
||||
integrity_check conflict-99.1
|
||||
integrity_check conflict-8.99
|
||||
|
||||
do_test conflict-9.1 {
|
||||
execsql {
|
||||
PRAGMA count_changes=0;
|
||||
CREATE TABLE t2(
|
||||
a INTEGER UNIQUE ON CONFLICT IGNORE,
|
||||
b INTEGER UNIQUE ON CONFLICT FAIL,
|
||||
c INTEGER UNIQUE ON CONFLICT REPLACE,
|
||||
d INTEGER UNIQUE ON CONFLICT ABORT,
|
||||
e INTEGER UNIQUE ON CONFLICT ROLLBACK
|
||||
);
|
||||
CREATE TABLE t3(x);
|
||||
INSERT INTO t3 VALUES(1);
|
||||
SELECT * FROM t3;
|
||||
}
|
||||
} {1}
|
||||
do_test conflict-9.2 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(1,1,1,1,1);
|
||||
INSERT INTO t2 VALUES(2,2,2,2,2);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {1 1 1 1 1 2 2 2 2 2}}
|
||||
do_test conflict-9.3 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(1,3,3,3,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {1 1 1 1 1 2 2 2 2 2}}
|
||||
do_test conflict-9.4 {
|
||||
catchsql {
|
||||
UPDATE t2 SET a=a+1 WHERE a=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {1 1 1 1 1 2 2 2 2 2}}
|
||||
do_test conflict-9.5 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(3,1,3,3,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.6 {
|
||||
catchsql {
|
||||
UPDATE t2 SET b=b+1 WHERE b=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.7 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
INSERT INTO t2 VALUES(3,1,3,3,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.8 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {2}
|
||||
do_test conflict-9.6 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
UPDATE t2 SET b=b+1 WHERE b=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.10 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {3}
|
||||
do_test conflict-9.11 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(3,3,3,1,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.12 {
|
||||
catchsql {
|
||||
UPDATE t2 SET d=d+1 WHERE d=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.13 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
INSERT INTO t2 VALUES(3,3,3,1,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.14 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {4}
|
||||
do_test conflict-9.15 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
UPDATE t2 SET d=d+1 WHERE d=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.16 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {5}
|
||||
do_test conflict-9.17 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(3,3,3,3,1);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.18 {
|
||||
catchsql {
|
||||
UPDATE t2 SET e=e+1 WHERE e=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.19 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
INSERT INTO t2 VALUES(3,3,3,3,1);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.20 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {5}
|
||||
do_test conflict-9.21 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
UPDATE t2 SET e=e+1 WHERE e=1;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {1 {constraint failed}}
|
||||
do_test conflict-9.22 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {5}
|
||||
do_test conflict-9.23 {
|
||||
catchsql {
|
||||
INSERT INTO t2 VALUES(3,3,1,3,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {2 2 2 2 2 3 3 1 3 3}}
|
||||
do_test conflict-9.24 {
|
||||
catchsql {
|
||||
UPDATE t2 SET c=c-1 WHERE c=2;
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {2 2 1 2 2}}
|
||||
do_test conflict-9.25 {
|
||||
catchsql {
|
||||
BEGIN;
|
||||
UPDATE t3 SET x=x+1;
|
||||
INSERT INTO t2 VALUES(3,3,1,3,3);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {0 {3 3 1 3 3}}
|
||||
do_test conflict-9.26 {
|
||||
execsql {COMMIT}
|
||||
execsql {SELECT * FROM t3}
|
||||
} {6}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# This file implements tests for joins, including outer joins.
|
||||
#
|
||||
# $Id: join.test,v 1.2 2002/05/25 00:18:21 drh Exp $
|
||||
# $Id: join.test,v 1.3 2002/06/28 12:18:48 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -164,6 +164,21 @@ do_test join-2.3 {
|
||||
SELECT * FROM t1 NATURAL RIGHT OUTER JOIN t2;
|
||||
}
|
||||
} {1 {RIGHT and FULL OUTER JOINs are not currently supported}}
|
||||
do_test join-2.4 {
|
||||
execsql {
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d
|
||||
}
|
||||
} {1 2 3 {} {} {} 2 3 4 {} {} {} 3 4 5 1 2 3}
|
||||
do_test join-2.5 {
|
||||
execsql {
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d WHERE t1.a>1
|
||||
}
|
||||
} {2 3 4 {} {} {} 3 4 5 1 2 3}
|
||||
do_test join-2.6 {
|
||||
execsql {
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.d WHERE t2.b IS NULL OR t2.b>1
|
||||
}
|
||||
} {1 2 3 {} {} {} 2 3 4 {} {} {}}
|
||||
|
||||
do_test join-3.1 {
|
||||
catchsql {
|
||||
|
||||
@@ -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.5 2002/05/08 21:30:16 drh Exp $
|
||||
# $Id: view.test,v 1.6 2002/06/28 12:18:48 drh Exp $
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
@@ -158,4 +158,48 @@ do_test view-3.5 {
|
||||
} {y 2 y 3 y 5 y 6}
|
||||
|
||||
|
||||
do_test view-4.1 {
|
||||
catchsql {
|
||||
DROP VIEW t1;
|
||||
}
|
||||
} {1 {use DROP TABLE to delete table t1}}
|
||||
do_test view-4.2 {
|
||||
execsql {
|
||||
SELECT 1 FROM t1 LIMIT 1;
|
||||
}
|
||||
} 1
|
||||
do_test view-4.3 {
|
||||
catchsql {
|
||||
DROP TABLE v1;
|
||||
}
|
||||
} {1 {use DROP VIEW to delete view v1}}
|
||||
do_test view-4.4 {
|
||||
execsql {
|
||||
SELECT 1 FROM v1 LIMIT 1;
|
||||
}
|
||||
} {1}
|
||||
do_test view-4.5 {
|
||||
catchsql {
|
||||
CREATE INDEX i1v1 ON v1(xyz);
|
||||
}
|
||||
} {1 {views may not be indexed}}
|
||||
|
||||
do_test view-5.1 {
|
||||
execsql {
|
||||
CREATE TABLE t2(y,a);
|
||||
INSERT INTO t2 VALUES(22,2);
|
||||
INSERT INTO t2 VALUES(33,3);
|
||||
INSERT INTO t2 VALUES(44,4);
|
||||
INSERT INTO t2 VALUES(55,5);
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {22 2 33 3 44 4 55 5}
|
||||
do_test view-5.2 {
|
||||
execsql {
|
||||
CREATE VIEW v5 AS
|
||||
SELECT t1.x, t2.y FROM t1 JOIN t2 USING(a);
|
||||
SELECT * FROM v5;
|
||||
}
|
||||
} {1 22 4 55}
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user