sl@0
|
1 |
# 2007 May 10
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
# This file implements regression tests for SQLite library.
|
sl@0
|
12 |
#
|
sl@0
|
13 |
# This file checks error recovery from malformed SQL strings.
|
sl@0
|
14 |
#
|
sl@0
|
15 |
# $Id: fuzz2.test,v 1.3 2007/05/15 16:51:37 drh Exp $
|
sl@0
|
16 |
|
sl@0
|
17 |
set testdir [file dirname $argv0]
|
sl@0
|
18 |
source $testdir/tester.tcl
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
proc fuzzcatch {sql} {
|
sl@0
|
22 |
return [lindex [catchsql $sql] 0]
|
sl@0
|
23 |
}
|
sl@0
|
24 |
|
sl@0
|
25 |
do_test fuzz2-1.1 {
|
sl@0
|
26 |
fuzzcatch {SELECT ALL "AAAAAA" . * GROUP BY LIMIT round(1), #12}
|
sl@0
|
27 |
} {1}
|
sl@0
|
28 |
do_test fuzz2-2.0 {
|
sl@0
|
29 |
fuzzcatch {SELECT + #100}
|
sl@0
|
30 |
} {1}
|
sl@0
|
31 |
do_test fuzz2-2.1 {
|
sl@0
|
32 |
fuzzcatch {SELECT 1 WHERE ( #61 NOT MATCH ROUND( 1 ) )}
|
sl@0
|
33 |
} {1}
|
sl@0
|
34 |
do_test fuzz2-2.2 {
|
sl@0
|
35 |
fuzzcatch {SELECT 1 LIMIT NOT #59 COLLATE AAAAAA NOT IN
|
sl@0
|
36 |
( "AAAAAA" NOTNULL <= x'414141414141' IS NULL , ( ROUND ( 1.0 ) ) )}
|
sl@0
|
37 |
} {1}
|
sl@0
|
38 |
do_test fuzz2-2.3 {
|
sl@0
|
39 |
fuzzcatch {INSERT OR REPLACE INTO AAAAAA . "AAAAAA" ( "AAAAAA" ) SELECT DISTINCT * , ( SELECT #252 IN ( SELECT DISTINCT AAAAAA . * ) )}
|
sl@0
|
40 |
} {1}
|
sl@0
|
41 |
do_test fuzz2-2.4 {
|
sl@0
|
42 |
fuzzcatch {SELECT 1 LIMIT NOT #59 COLLATE AAAAAA NOT IN round(1.0)}
|
sl@0
|
43 |
} {1}
|
sl@0
|
44 |
do_test fuzz2-2.5 {
|
sl@0
|
45 |
fuzzcatch {SELECT( #239 )}
|
sl@0
|
46 |
} {1}
|
sl@0
|
47 |
do_test fuzz2-2.6 {
|
sl@0
|
48 |
fuzzcatch {DELETE FROM AAAAAA WHERE #65 NOT NULL}
|
sl@0
|
49 |
} {1}
|
sl@0
|
50 |
do_test fuzz2-2.7 {
|
sl@0
|
51 |
fuzzcatch {ATTACH ROUND( 1.0 ) in AAAAAA . "AAAAAA" AS #122 ISNULL}
|
sl@0
|
52 |
} {1}
|
sl@0
|
53 |
do_test fuzz2-2.8 {
|
sl@0
|
54 |
fuzzcatch {SELECT 1 LIMIT #122 ISNULL}
|
sl@0
|
55 |
} {1}
|
sl@0
|
56 |
do_test fuzz2-2.9 {
|
sl@0
|
57 |
fuzzcatch {CREATE VIEW AAAAAA . "AAAAAA" AS SELECT DISTINCT #162 IS NULL "AAAAAA"}
|
sl@0
|
58 |
} {1}
|
sl@0
|
59 |
do_test fuzz2-2.10 {
|
sl@0
|
60 |
fuzzcatch {DELETE FROM AAAAAA WHERE #202 IS NOT NULL ISNULL}
|
sl@0
|
61 |
} {1}
|
sl@0
|
62 |
do_test fuzz2-2.11 {
|
sl@0
|
63 |
fuzzcatch {UPDATE OR IGNORE "AAAAAA" . "AAAAAA" SET "AAAAAA" = NOT #96}
|
sl@0
|
64 |
} {1}
|
sl@0
|
65 |
do_test fuzz2-2.12 {
|
sl@0
|
66 |
fuzzcatch {SELECT - #196}
|
sl@0
|
67 |
} {1}
|
sl@0
|
68 |
do_test fuzz2-3.0 {
|
sl@0
|
69 |
fuzzcatch {CREATE TRIGGER "AAAAAA" . "AAAAAA" AFTER UPDATE OF "AAAAAA" , "AAAAAA" ON "AAAAAA" . "AAAAAA" FOR EACH ROW BEGIN UPDATE AAAAAA SET "AAAAAA" = #162; END}
|
sl@0
|
70 |
} {1}
|
sl@0
|
71 |
do_test fuzz2-3.1 {
|
sl@0
|
72 |
fuzzcatch {CREATE TRIGGER IF NOT EXISTS "AAAAAA" UPDATE ON "AAAAAA" . AAAAAA FOR EACH ROW BEGIN DELETE FROM "AAAAAA" ; INSERT INTO AAAAAA ( "AAAAAA" ) SELECT DISTINCT "AAAAAA" "AAAAAA" , #167 AAAAAA , "AAAAAA" . * ORDER BY "AAAAAA" ASC , x'414141414141' BETWEEN RAISE ( FAIL , "AAAAAA" ) AND AAAAAA ( * ) NOT NULL DESC LIMIT AAAAAA ; REPLACE INTO AAAAAA ( AAAAAA ) VALUES ( AAAAAA ( * ) ) ; END}
|
sl@0
|
73 |
} {1}
|
sl@0
|
74 |
do_test fuzz2-3.2 {
|
sl@0
|
75 |
fuzzcatch {CREATE TEMP TRIGGER IF NOT EXISTS AAAAAA . "AAAAAA" BEFORE UPDATE OF "AAAAAA" ON AAAAAA . "AAAAAA" BEGIN SELECT ALL * , #175 "AAAAAA" FROM "AAAAAA" . AAAAAA; END}
|
sl@0
|
76 |
} {1}
|
sl@0
|
77 |
do_test fuzz2-4.0 {
|
sl@0
|
78 |
fuzzcatch {ATTACH DATABASE #168 AS whatever}
|
sl@0
|
79 |
} {1}
|
sl@0
|
80 |
do_test fuzz2-4.1 {
|
sl@0
|
81 |
fuzzcatch {DETACH #133}
|
sl@0
|
82 |
} {1}
|
sl@0
|
83 |
do_test fuzz2-5.0 {
|
sl@0
|
84 |
fuzzcatch {SELECT 1 LIMIT ( SELECT DISTINCT * , AAAAAA , * , AAAAAA , "AAAAAA" . * FROM "AAAAAA" ON ROUND( 1 ) COLLATE AAAAAA OR "AAAAAA" USING ( AAAAAA , "AAAAAA" ) WHERE ROUND( 1 ) GROUP BY ORDER BY #84 ASC , #44 DESC , ( SELECT "AAAAAA" . * , "AAAAAA" . * FROM , ( ) "AAAAAA" USING ( )}
|
sl@0
|
85 |
} {1}
|
sl@0
|
86 |
do_test fuzz2-5.1 {
|
sl@0
|
87 |
fuzzcatch {SELECT 1 WHERE 1 == AAAAAA ( * ) BETWEEN + - ~ + "AAAAAA" . AAAAAA | RAISE ( IGNORE ) COLLATE AAAAAA NOT IN ( SELECT DISTINCT "AAAAAA" . * , * , * WHERE ( SELECT ALL AAAAAA AS "AAAAAA" HAVING CAST ( "AAAAAA" . "AAAAAA" . "AAAAAA" AS AAAAAA ) ORDER BY , , IS NULL ASC , ~ AND DESC LIMIT ( ( "AAAAAA" ) NOT BETWEEN ( ) NOT IN ( ) AND AAAAAA ( ) IS NOT NULL ) OFFSET AAAAAA ( ALL , , ) ) GROUP BY ORDER BY "AAAAAA" . AAAAAA ASC , NULL IN ( SELECT UNION ALL SELECT ALL WHERE HAVING ORDER BY LIMIT UNION SELECT DISTINCT FROM ( ) WHERE + HAVING >> ORDER BY LIMIT . . , "AAAAAA" ) , CAST ( ~ "AAAAAA" . AAAAAA AS "AAAAAA" AAAAAA "AAAAAA" ( + 4294967295 , - 4294967296.0 ) ) ASC LIMIT AAAAAA INTERSECT SELECT ALL * GROUP BY , AAAAAA ( DISTINCT , ) != #241 NOT IN ( , , ) , , CTIME_KW HAVING AAAAAA ORDER BY #103 DESC , #81 ASC LIMIT AAAAAA OFFSET ~ AAAAAA ( ALL AAAAAA . AAAAAA >= AAAAAA . "AAAAAA" . "AAAAAA" ) ) NOTNULL NOT NULL}
|
sl@0
|
88 |
} {1}
|
sl@0
|
89 |
do_test fuzz2-5.2 {
|
sl@0
|
90 |
fuzzcatch {SELECT 1 WHERE 1 == AAAAAA ( * ) BETWEEN + - ~ + "AAAAAA" . AAAAAA | RAISE ( IGNORE ) COLLATE AAAAAA NOT IN ( SELECT DISTINCT "AAAAAA" . * , * , * WHERE ( SELECT ALL AAAAAA AS "AAAAAA" HAVING CAST ( "AAAAAA" . "AAAAAA" . "AAAAAA" AS AAAAAA ) ORDER BY , , IS NULL ASC , ~ AND DESC LIMIT ( ( "AAAAAA" ) NOT BETWEEN ( ) NOT IN ( ) AND AAAAAA ( ) IS NOT NULL ) OFFSET AAAAAA ( ALL , , ) ) GROUP BY ORDER BY "AAAAAA" . AAAAAA ASC , NULL IN ( SELECT UNION ALL SELECT ALL WHERE HAVING ORDER BY LIMIT UNION SELECT DISTINCT FROM ( ) WHERE + HAVING >> ORDER BY LIMIT . . , "AAAAAA" ) , CAST ( ~ "AAAAAA" . AAAAAA AS "AAAAAA" AAAAAA "AAAAAA" ( + 4294967295 , - 4294967296.0 ) ) ASC LIMIT AAAAAA INTERSECT SELECT ALL * GROUP BY , AAAAAA ( DISTINCT , ) != #241 NOT IN ( , , ) , , CTIME_KW HAVING AAAAAA ORDER BY #103 DESC , #81 ASC LIMIT AAAAAA OFFSET ~ AAAAAA ( ALL AAAAAA . AAAAAA >= AAAAAA . "AAAAAA" . "AAAAAA" ) ) NOTNULL NOT NULL}
|
sl@0
|
91 |
} {1}
|
sl@0
|
92 |
do_test fuzz2-5.3 {
|
sl@0
|
93 |
fuzzcatch {UPDATE "AAAAAA" SET "AAAAAA" = - EXISTS ( SELECT DISTINCT * , * ORDER BY #202 ASC , #147 , ~ AAAAAA . "AAAAAA" ASC LIMIT AAAAAA . "AAAAAA" , RAISE ( ABORT , AAAAAA ) UNION ALL SELECT DISTINCT AAAAAA . * , * FROM ( SELECT DISTINCT}
|
sl@0
|
94 |
} {1}
|
sl@0
|
95 |
do_test fuzz2-5.4 {
|
sl@0
|
96 |
fuzzcatch {REPLACE INTO AAAAAA SELECT DISTINCT "AAAAAA" . * WHERE AAAAAA ( AAAAAA ( ) ) GROUP BY AAAAAA . AAAAAA . "AAAAAA" IN "AAAAAA" | AAAAAA ( ALL , ) ORDER BY #238, #92 DESC LIMIT 0 OFFSET - RAISE ( IGNORE ) NOT NULL > RAISE ( IGNORE ) IS NULL}
|
sl@0
|
97 |
} {1}
|
sl@0
|
98 |
do_test fuzz2-5.5 {
|
sl@0
|
99 |
fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) AS AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAAA" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AAAAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( }
|
sl@0
|
100 |
} {1}
|
sl@0
|
101 |
|
sl@0
|
102 |
finish_test
|