-C Do\snot\signore\salias\s"a"\sin\sa\squery\sof\sthe\sform\s"SELECT\s...\sFROM\s(...)\sAS\sa"\sFix\sfor\s#3935.\sAlso\sexpand\supon\s(6751)\sto\sfix\ssome\ssimilar\sobscure\smemory\sleaks.\s(CVS\s6831)
-D 2009-07-01T14:56:40
+C Report\san\serror\sif\sa\sUSING\sor\sON\sclause\sis\sspecified\sfollowing\sa\sfrom-list\selement\sthat\sis\snot\sto\sthe\sright\sof\sa\sjoin\soperator.\sFix\sfor\s#3846.\s(CVS\s6832)
+D 2009-07-01T16:12:08
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/btree.c 078eb41016d033707f8a94075cdde18249e48f75
F src/btree.h f70b694e8c163227369a66863b01fbff9009f323
F src/btreeInt.h 55346bc14b939ad41b297942e8b1b581e960fb99
-F src/build.c 1906bb2856f7013c9ab5ff1e0eeab033ed1c00ba
+F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
F src/callback.c cb68b21b0d4ae7d11ae0e487933bce3323784dcf
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
F test/ioerr4.test fc6eddfec2efc2f1ed217b9eae4c1c1d3516ce86
F test/ioerr5.test 89f69b09a6b5d4f5bbfe58d4231f28236d842dcb
-F test/join.test c5696c7e7efd8b3780c9308e4511742a937fe660
+F test/join.test a79084b09d862e7be924abb97d1b1342a0157209
F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/tkt3918.test e6cdf6bfcfe9ba939d86a4238a9dc55d6eec5d42
F test/tkt3922.test 022ace32c049e3964f68492c12eb803e8e4856d8
F test/tkt3929.test 6a4c3baefb4e75127356b7d675b5df42c35c00d1
-F test/tkt3935.test 209a67e511c15adb572d536689a4e02ea4fcbb00
+F test/tkt3935.test e15261fedb9e30a4305a311da614a5d8e693c767
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
F test/trace.test 19ffbc09885c3321d56358a5738feae8587fb377
F test/trans.test d887cb07630dc39879a322d958ad8b006137485c
F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1
F test/vtab4.test 942f8b8280b3ea8a41dae20e7822d065ca1cb275
F test/vtab5.test a0a84a89c622f4e2e816ebf39883dc319b4a1024
-F test/vtab6.test a56c947193fb28ddb453d38768cb8acc6f2eed79
+F test/vtab6.test 226b116d63ad77f9b084d556f772c45a0d28e9b5
F test/vtab7.test a8c3c3cb3eb60be364991bd714e4927e26c4cd85
F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583
F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P f17ef37897da9bcaf20b5acdce6840522c0a0b16
-R 0a4b75c01f05a0efdc0d38590a4ebf72
+P 42f9d1e56483a59353bff57d75f09ed67e1d9c3c
+R 23d368ef27404e6adaeea4f513ad5353
U danielk1977
-Z aee332d7efb75dc0b087c0e560dcdc1e
+Z 8f538dfbca52be8303d8e87518479b92
-42f9d1e56483a59353bff57d75f09ed67e1d9c3c
\ No newline at end of file
+29b48972b65a17dab343b063a620cf8d456a923c
\ No newline at end of file
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.555 2009/07/01 14:56:40 danielk1977 Exp $
+** $Id: build.c,v 1.556 2009/07/01 16:12:08 danielk1977 Exp $
*/
#include "sqliteInt.h"
){
struct SrcList_item *pItem;
sqlite3 *db = pParse->db;
+ if( !p && (pOn || pUsing) ){
+ sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
+ (pOn ? "ON" : "USING")
+ );
+ goto append_from_error;
+ }
p = sqlite3SrcListAppend(db, p, pTable, pDatabase);
if( p==0 || NEVER(p->nSrc==0) ){
- sqlite3ExprDelete(db, pOn);
- sqlite3IdListDelete(db, pUsing);
- sqlite3SelectDelete(db, pSubquery);
- return p;
+ goto append_from_error;
}
pItem = &p->a[p->nSrc-1];
assert( pAlias!=0 );
pItem->zAlias = sqlite3NameFromToken(db, pAlias);
}
pItem->pSelect = pSubquery;
- if( p->nSrc>1 ){
- pItem->pOn = pOn;
- pItem->pUsing = pUsing;
- }else{
- sqlite3ExprDelete(db, pOn);
- sqlite3IdListDelete(db, pUsing);
- }
+ pItem->pOn = pOn;
+ pItem->pUsing = pUsing;
return p;
+
+ append_from_error:
+ assert( p==0 );
+ sqlite3ExprDelete(db, pOn);
+ sqlite3IdListDelete(db, pUsing);
+ sqlite3SelectDelete(db, pSubquery);
+ return 0;
}
/*
#
# This file implements tests for joins, including outer joins.
#
-# $Id: join.test,v 1.26 2008/12/05 00:00:07 drh Exp $
+# $Id: join.test,v 1.27 2009/07/01 16:12:08 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1 {cannot join using column d - column not present in both tables}}
do_test join-3.5 {
- catchsql {
- SELECT * FROM t1 USING(a);
- }
-} {0 {1 2 3 2 3 4 3 4 5}}
+ catchsql { SELECT * FROM t1 USING(a) }
+} {1 {a JOIN clause is required before USING}}
do_test join-3.6 {
catchsql {
SELECT * FROM t1 JOIN t2 ON t3.a=t2.b;
#
# This file implements tests to verify that ticket #3935 has been fixed.
#
-# $Id: tkt3935.test,v 1.1 2009/07/01 14:56:41 danielk1977 Exp $
+# $Id: tkt3935.test,v 1.2 2009/07/01 16:12:08 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test tkt3935.4 {
- execsql { SELECT a FROM (t1) AS t ON b USING(a) }
-} {}
+ catchsql { SELECT a FROM (t1) AS t ON b USING(a) }
+} {1 {a JOIN clause is required before ON}}
do_test tkt3935.5 {
- execsql { SELECT a FROM (t1) AS t ON b }
-} {}
+ catchsql { SELECT a FROM (t1) AS t ON b }
+} {1 {a JOIN clause is required before ON}}
do_test tkt3935.6 {
- execsql { SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a) }
-} {}
+ catchsql { SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a) }
+} {1 {a JOIN clause is required before ON}}
do_test tkt3935.7 {
- execsql { SELECT a FROM (SELECT * FROM t1) AS t ON b }
-} {}
+ catchsql { SELECT a FROM (SELECT * FROM t1) AS t ON b }
+} {1 {a JOIN clause is required before ON}}
do_test tkt3935.8 {
- execsql { SELECT a FROM t1 AS t ON b }
-} {}
+ catchsql { SELECT a FROM t1 AS t ON b }
+} {1 {a JOIN clause is required before ON}}
do_test tkt3935.9 {
- execsql { SELECT a FROM t1 AS t ON b USING(a) }
-} {}
+ catchsql { SELECT a FROM t1 AS t ON b USING(a) }
+} {1 {a JOIN clause is required before ON}}
+do_test tkt3935.10 {
+ catchsql { SELECT a FROM t1 AS t USING(a) }
+} {1 {a JOIN clause is required before USING}}
finish_test
# virtual tables. The test cases in this file are copied from the file
# join.test, and some of the comments still reflect that.
#
-# $Id: vtab6.test,v 1.4 2008/07/12 14:52:21 drh Exp $
+# $Id: vtab6.test,v 1.5 2009/07/01 16:12:08 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1 {cannot join using column a - column not present in both tables}}
do_test vtab6-3.5 {
- catchsql {
- SELECT * FROM t1 USING(a);
- }
-} {0 {1 2 3 2 3 4 3 4 5}}
+ catchsql { SELECT * FROM t1 USING(a) }
+} {1 {a JOIN clause is required before USING}}
do_test vtab6-3.6 {
catchsql {
SELECT * FROM t1 JOIN t2 ON t3.a=t2.b;