1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Fix bug in anonymous subquery in a join. Parser requires a semicolon or

end-of-input before executing. (CVS 429)

FossilOrigin-Name: c0e3f1c592f583a0659901743a368aff1927f1cb
This commit is contained in:
drh
2002-03-13 18:54:07 +00:00
parent 56c0e926f1
commit 094b2bbfc7
8 changed files with 58 additions and 22 deletions

View File

@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc1.test,v 1.3 2002/02/14 12:50:35 drh Exp $
# $Id: misc1.test,v 1.4 2002/03/13 18:54:08 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -134,4 +134,22 @@ do_test misc1-4.1 {
}
} {64}
# Make sure we actually see a semicolon or end-of-file in the SQL input
# before executing a command. Thus if "WHERE" is misspelled on an UPDATE,
# the user won't accidently update every record.
#
do_test misc1-5.1 {
catchsql {
CREATE TABLE t3(a,b);
INSERT INTO t3 VALUES(1,2);
INSERT INTO t3 VALUES(3,4);
UPDATE t3 SET a=0 WHEREwww b=2;
}
} {1 {near "WHEREwww": syntax error}}
do_test misc1-5.2 {
execsql {
SELECT * FROM t3 ORDER BY a;
}
} {1 2 3 4}
finish_test

View File

@@ -12,7 +12,7 @@
# focus of this file is testing SELECT statements that contain
# subqueries in their FROM clause.
#
# $Id: select6.test,v 1.6 2002/03/03 03:42:31 drh Exp $
# $Id: select6.test,v 1.7 2002/03/13 18:54:09 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -282,5 +282,14 @@ do_test select6-5.1 {
ORDER BY a
}
} {8 5 8 9 6 9 10 7 10}
do_test select6-5.2 {
execsql {
SELECT a,x,b FROM
(SELECT x+3 AS 'a', x FROM t1 WHERE y=3),
(SELECT x AS 'b' FROM t1 WHERE y=4)
WHERE a=b
ORDER BY a
}
} {8 5 8 9 6 9 10 7 10}
finish_test