# use AROS_LIB/INCLUDES
[AROS-Contrib.git] / sqlite3 / test / index.test
blobce0fe2e25a1f227269d784303029ee2ce3caf480
1 # 2001 September 15
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.  The
12 # focus of this file is testing the CREATE INDEX statement.
14 # $Id: index.test,v 1.37 2005/01/21 03:12:16 danielk1977 Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 # Create a basic index and verify it is added to sqlite_master
21 do_test index-1.1 {
22   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)}
23   execsql {CREATE INDEX index1 ON test1(f1)}
24   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
25 } {index1 test1}
26 do_test index-1.1b {
27   execsql {SELECT name, sql, tbl_name, type FROM sqlite_master 
28            WHERE name='index1'}
29 } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index}
30 do_test index-1.1c {
31   db close
32   sqlite3 db test.db
33   execsql {SELECT name, sql, tbl_name, type FROM sqlite_master 
34            WHERE name='index1'}
35 } {index1 {CREATE INDEX index1 ON test1(f1)} test1 index}
36 do_test index-1.1d {
37   db close
38   sqlite3 db test.db
39   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
40 } {index1 test1}
42 # Verify that the index dies with the table
44 do_test index-1.2 {
45   execsql {DROP TABLE test1}
46   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
47 } {}
49 # Try adding an index to a table that does not exist
51 do_test index-2.1 {
52   set v [catch {execsql {CREATE INDEX index1 ON test1(f1)}} msg]
53   lappend v $msg
54 } {1 {no such table: main.test1}}
56 # Try adding an index on a column of a table where the table
57 # exists but the column does not.
59 do_test index-2.1 {
60   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)}
61   set v [catch {execsql {CREATE INDEX index1 ON test1(f4)}} msg]
62   lappend v $msg
63 } {1 {table test1 has no column named f4}}
65 # Try an index with some columns that match and others that do now.
67 do_test index-2.2 {
68   set v [catch {execsql {CREATE INDEX index1 ON test1(f1, f2, f4, f3)}} msg]
69   execsql {DROP TABLE test1}
70   lappend v $msg
71 } {1 {table test1 has no column named f4}}
73 # Try creating a bunch of indices on the same table
75 set r {}
76 for {set i 1} {$i<100} {incr i} {
77   lappend r [format index%02d $i]
79 do_test index-3.1 {
80   execsql {CREATE TABLE test1(f1 int, f2 int, f3 int, f4 int, f5 int)}
81   for {set i 1} {$i<100} {incr i} {
82     set sql "CREATE INDEX [format index%02d $i] ON test1(f[expr {($i%5)+1}])"
83     execsql $sql
84   }
85   execsql {SELECT name FROM sqlite_master 
86            WHERE type='index' AND tbl_name='test1'
87            ORDER BY name}
88 } $r
89 integrity_check index-3.2.1
90 ifcapable {reindex} {
91   do_test index-3.2.2 {
92     execsql REINDEX
93   } {}
95 integrity_check index-3.2.3
98 # Verify that all the indices go away when we drop the table.
100 do_test index-3.3 {
101   execsql {DROP TABLE test1}
102   execsql {SELECT name FROM sqlite_master 
103            WHERE type='index' AND tbl_name='test1'
104            ORDER BY name}
105 } {}
107 # Create a table and insert values into that table.  Then create
108 # an index on that table.  Verify that we can select values
109 # from the table correctly using the index.
111 # Note that the index names "index9" and "indext" are chosen because
112 # they both have the same hash.
114 do_test index-4.1 {
115   execsql {CREATE TABLE test1(cnt int, power int)}
116   for {set i 1} {$i<20} {incr i} {
117     execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
118   }
119   execsql {CREATE INDEX index9 ON test1(cnt)}
120   execsql {CREATE INDEX indext ON test1(power)}
121   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
122 } {index9 indext test1}
123 do_test index-4.2 {
124   execsql {SELECT cnt FROM test1 WHERE power=4}
125 } {2}
126 do_test index-4.3 {
127   execsql {SELECT cnt FROM test1 WHERE power=1024}
128 } {10}
129 do_test index-4.4 {
130   execsql {SELECT power FROM test1 WHERE cnt=6}
131 } {64}
132 do_test index-4.5 {
133   execsql {DROP INDEX indext}
134   execsql {SELECT power FROM test1 WHERE cnt=6}
135 } {64}
136 do_test index-4.6 {
137   execsql {SELECT cnt FROM test1 WHERE power=1024}
138 } {10}
139 do_test index-4.7 {
140   execsql {CREATE INDEX indext ON test1(cnt)}
141   execsql {SELECT power FROM test1 WHERE cnt=6}
142 } {64}
143 do_test index-4.8 {
144   execsql {SELECT cnt FROM test1 WHERE power=1024}
145 } {10}
146 do_test index-4.9 {
147   execsql {DROP INDEX index9}
148   execsql {SELECT power FROM test1 WHERE cnt=6}
149 } {64}
150 do_test index-4.10 {
151   execsql {SELECT cnt FROM test1 WHERE power=1024}
152 } {10}
153 do_test index-4.11 {
154   execsql {DROP INDEX indext}
155   execsql {SELECT power FROM test1 WHERE cnt=6}
156 } {64}
157 do_test index-4.12 {
158   execsql {SELECT cnt FROM test1 WHERE power=1024}
159 } {10}
160 do_test index-4.13 {
161   execsql {DROP TABLE test1}
162   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
163 } {}
164 integrity_check index-4.14
166 # Do not allow indices to be added to sqlite_master
168 do_test index-5.1 {
169   set v [catch {execsql {CREATE INDEX index1 ON sqlite_master(name)}} msg]
170   lappend v $msg
171 } {1 {table sqlite_master may not be indexed}}
172 do_test index-5.2 {
173   execsql {SELECT name FROM sqlite_master WHERE type!='meta'}
174 } {}
176 # Do not allow indices with duplicate names to be added
178 do_test index-6.1 {
179   execsql {CREATE TABLE test1(f1 int, f2 int)}
180   execsql {CREATE TABLE test2(g1 real, g2 real)}
181   execsql {CREATE INDEX index1 ON test1(f1)}
182   set v [catch {execsql {CREATE INDEX index1 ON test2(g1)}} msg]
183   lappend v $msg
184 } {1 {index index1 already exists}}
185 do_test index-6.1b {
186   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
187 } {index1 test1 test2}
188 do_test index-6.2 {
189   set v [catch {execsql {CREATE INDEX test1 ON test2(g1)}} msg]
190   lappend v $msg
191 } {1 {there is already a table named test1}}
192 do_test index-6.2b {
193   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
194 } {index1 test1 test2}
195 do_test index-6.3 {
196   execsql {DROP TABLE test1}
197   execsql {DROP TABLE test2}
198   execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name}
199 } {}
200 do_test index-6.4 {
201   execsql {
202     CREATE TABLE test1(a,b);
203     CREATE INDEX index1 ON test1(a);
204     CREATE INDEX index2 ON test1(b);
205     CREATE INDEX index3 ON test1(a,b);
206     DROP TABLE test1;
207     SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name;
208   }
209 } {}
210 integrity_check index-6.5
213 # Create a primary key
215 do_test index-7.1 {
216   execsql {CREATE TABLE test1(f1 int, f2 int primary key)}
217   for {set i 1} {$i<20} {incr i} {
218     execsql "INSERT INTO test1 VALUES($i,[expr {int(pow(2,$i))}])"
219   }
220   execsql {SELECT count(*) FROM test1}
221 } {19}
222 do_test index-7.2 {
223   execsql {SELECT f1 FROM test1 WHERE f2=65536}
224 } {16}
225 do_test index-7.3 {
226   execsql {
227     SELECT name FROM sqlite_master 
228     WHERE type='index' AND tbl_name='test1'
229   }
230 } {sqlite_autoindex_test1_1}
231 do_test index-7.4 {
232   execsql {DROP table test1}
233   execsql {SELECT name FROM sqlite_master WHERE type!='meta'}
234 } {}
235 integrity_check index-7.5
237 # Make sure we cannot drop a non-existant index.
239 do_test index-8.1 {
240   set v [catch {execsql {DROP INDEX index1}} msg]
241   lappend v $msg
242 } {1 {no such index: index1}}
244 # Make sure we don't actually create an index when the EXPLAIN keyword
245 # is used.
247 do_test index-9.1 {
248   execsql {CREATE TABLE tab1(a int)}
249   ifcapable {explain} {
250     execsql {EXPLAIN CREATE INDEX idx1 ON tab1(a)}
251   }
252   execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1'}
253 } {tab1}
254 do_test index-9.2 {
255   execsql {CREATE INDEX idx1 ON tab1(a)}
256   execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1' ORDER BY name}
257 } {idx1 tab1}
258 integrity_check index-9.3
260 # Allow more than one entry with the same key.
262 do_test index-10.0 {
263   execsql {
264     CREATE TABLE t1(a int, b int);
265     CREATE INDEX i1 ON t1(a);
266     INSERT INTO t1 VALUES(1,2);
267     INSERT INTO t1 VALUES(2,4);
268     INSERT INTO t1 VALUES(3,8);
269     INSERT INTO t1 VALUES(1,12);
270     SELECT b FROM t1 WHERE a=1 ORDER BY b;
271   }
272 } {2 12}
273 do_test index-10.1 {
274   execsql {
275     SELECT b FROM t1 WHERE a=2 ORDER BY b;
276   }
277 } {4}
278 do_test index-10.2 {
279   execsql {
280     DELETE FROM t1 WHERE b=12;
281     SELECT b FROM t1 WHERE a=1 ORDER BY b;
282   }
283 } {2}
284 do_test index-10.3 {
285   execsql {
286     DELETE FROM t1 WHERE b=2;
287     SELECT b FROM t1 WHERE a=1 ORDER BY b;
288   }
289 } {}
290 do_test index-10.4 {
291   execsql {
292     DELETE FROM t1;
293     INSERT INTO t1 VALUES (1,1);
294     INSERT INTO t1 VALUES (1,2);
295     INSERT INTO t1 VALUES (1,3);
296     INSERT INTO t1 VALUES (1,4);
297     INSERT INTO t1 VALUES (1,5);
298     INSERT INTO t1 VALUES (1,6);
299     INSERT INTO t1 VALUES (1,7);
300     INSERT INTO t1 VALUES (1,8);
301     INSERT INTO t1 VALUES (1,9);
302     INSERT INTO t1 VALUES (2,0);
303     SELECT b FROM t1 WHERE a=1 ORDER BY b;
304   }
305 } {1 2 3 4 5 6 7 8 9}
306 do_test index-10.5 {
307   ifcapable subquery {
308     execsql { DELETE FROM t1 WHERE b IN (2, 4, 6, 8); }
309   } else {
310     execsql { DELETE FROM t1 WHERE b = 2 OR b = 4 OR b = 6 OR b = 8; }
311   }
312   execsql {
313     SELECT b FROM t1 WHERE a=1 ORDER BY b;
314   }
315 } {1 3 5 7 9}
316 do_test index-10.6 {
317   execsql {
318     DELETE FROM t1 WHERE b>2;
319     SELECT b FROM t1 WHERE a=1 ORDER BY b;
320   }
321 } {1}
322 do_test index-10.7 {
323   execsql {
324     DELETE FROM t1 WHERE b=1;
325     SELECT b FROM t1 WHERE a=1 ORDER BY b;
326   }
327 } {}
328 do_test index-10.8 {
329   execsql {
330     SELECT b FROM t1 ORDER BY b;
331   }
332 } {0}
333 integrity_check index-10.9
335 # Automatically create an index when we specify a primary key.
337 do_test index-11.1 {
338   execsql {
339     CREATE TABLE t3(
340       a text,
341       b int,
342       c float,
343       PRIMARY KEY(b)
344     );
345   }
346   for {set i 1} {$i<=50} {incr i} {
347     execsql "INSERT INTO t3 VALUES('x${i}x',$i,0.$i)"
348   }
349   set sqlite_search_count 0
350   concat [execsql {SELECT c FROM t3 WHERE b==10}] $sqlite_search_count
351 } {0.1 3}
352 integrity_check index-11.2
355 # Numeric strings should compare as if they were numbers.  So even if the
356 # strings are not character-by-character the same, if they represent the
357 # same number they should compare equal to one another.  Verify that this
358 # is true in indices.
360 # Updated for sqlite3 v3: SQLite will now store these values as numbers
361 # (because the affinity of column a is NUMERIC) so the quirky
362 # representations are not retained. i.e. '+1.0' becomes '1'.
363 do_test index-12.1 {
364   execsql {
365     CREATE TABLE t4(a NUM,b);
366     INSERT INTO t4 VALUES('0.0',1);
367     INSERT INTO t4 VALUES('0.00',2);
368     INSERT INTO t4 VALUES('abc',3);
369     INSERT INTO t4 VALUES('-1.0',4);
370     INSERT INTO t4 VALUES('+1.0',5);
371     INSERT INTO t4 VALUES('0',6);
372     INSERT INTO t4 VALUES('00000',7);
373     SELECT a FROM t4 ORDER BY b;
374   }
375 } {0.0 0.0 abc -1.0 1.0 0 0}
376 do_test index-12.2 {
377   execsql {
378     SELECT a FROM t4 WHERE a==0 ORDER BY b
379   }
380 } {0.0 0.0 0 0}
381 do_test index-12.3 {
382   execsql {
383     SELECT a FROM t4 WHERE a<0.5 ORDER BY b
384   }
385 } {0.0 0.0 -1.0 0 0}
386 do_test index-12.4 {
387   execsql {
388     SELECT a FROM t4 WHERE a>-0.5 ORDER BY b
389   }
390 } {0.0 0.0 abc 1.0 0 0}
391 do_test index-12.5 {
392   execsql {
393     CREATE INDEX t4i1 ON t4(a);
394     SELECT a FROM t4 WHERE a==0 ORDER BY b
395   }
396 } {0.0 0.0 0 0}
397 do_test index-12.6 {
398   execsql {
399     SELECT a FROM t4 WHERE a<0.5 ORDER BY b
400   }
401 } {0.0 0.0 -1.0 0 0}
402 do_test index-12.7 {
403   execsql {
404     SELECT a FROM t4 WHERE a>-0.5 ORDER BY b
405   }
406 } {0.0 0.0 abc 1.0 0 0}
407 integrity_check index-12.8
409 # Make sure we cannot drop an automatically created index.
411 do_test index-13.1 {
412   execsql {
413    CREATE TABLE t5(
414       a int UNIQUE,
415       b float PRIMARY KEY,
416       c varchar(10),
417       UNIQUE(a,c)
418    );
419    INSERT INTO t5 VALUES(1,2,3);
420    SELECT * FROM t5;
421   }
422 } {1 2 3}
423 do_test index-13.2 {
424   set ::idxlist [execsql {
425     SELECT name FROM sqlite_master WHERE type="index" AND tbl_name="t5";
426   }]
427   llength $::idxlist
428 } {3}
429 for {set i 0} {$i<[llength $::idxlist]} {incr i} {
430   do_test index-13.3.$i {
431     catchsql "
432       DROP INDEX '[lindex $::idxlist $i]';
433     "
434   } {1 {index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped}}
436 do_test index-13.4 {
437   execsql {
438     INSERT INTO t5 VALUES('a','b','c');
439     SELECT * FROM t5;
440   }
441 } {1 2 3 a b c}
442 integrity_check index-13.5
444 # Check the sort order of data in an index.
446 do_test index-14.1 {
447   execsql {
448     CREATE TABLE t6(a,b,c);
449     CREATE INDEX t6i1 ON t6(a,b);
450     INSERT INTO t6 VALUES('','',1);
451     INSERT INTO t6 VALUES('',NULL,2);
452     INSERT INTO t6 VALUES(NULL,'',3);
453     INSERT INTO t6 VALUES('abc',123,4);
454     INSERT INTO t6 VALUES(123,'abc',5);
455     SELECT c FROM t6 ORDER BY a,b;
456   }
457 } {3 5 2 1 4}
458 do_test index-14.2 {
459   execsql {
460     SELECT c FROM t6 WHERE a='';
461   }
462 } {2 1}
463 do_test index-14.3 {
464   execsql {
465     SELECT c FROM t6 WHERE b='';
466   }
467 } {1 3}
468 do_test index-14.4 {
469   execsql {
470     SELECT c FROM t6 WHERE a>'';
471   }
472 } {4}
473 do_test index-14.5 {
474   execsql {
475     SELECT c FROM t6 WHERE a>='';
476   }
477 } {2 1 4}
478 do_test index-14.6 {
479   execsql {
480     SELECT c FROM t6 WHERE a>123;
481   }
482 } {2 1 4}
483 do_test index-14.7 {
484   execsql {
485     SELECT c FROM t6 WHERE a>=123;
486   }
487 } {5 2 1 4}
488 do_test index-14.8 {
489   execsql {
490     SELECT c FROM t6 WHERE a<'abc';
491   }
492 } {5 2 1}
493 do_test index-14.9 {
494   execsql {
495     SELECT c FROM t6 WHERE a<='abc';
496   }
497 } {5 2 1 4}
498 do_test index-14.10 {
499   execsql {
500     SELECT c FROM t6 WHERE a<='';
501   }
502 } {5 2 1}
503 do_test index-14.11 {
504   execsql {
505     SELECT c FROM t6 WHERE a<'';
506   }
507 } {5}
508 integrity_check index-14.12
510 do_test index-15.1 {
511   execsql {
512     DELETE FROM t1;
513     SELECT * FROM t1;
514   }
515 } {}
516 do_test index-15.2 {
517   execsql {
518     INSERT INTO t1 VALUES('1.234e5',1);
519     INSERT INTO t1 VALUES('12.33e04',2);
520     INSERT INTO t1 VALUES('12.35E4',3);
521     INSERT INTO t1 VALUES('12.34e',4);
522     INSERT INTO t1 VALUES('12.32e+4',5);
523     INSERT INTO t1 VALUES('12.36E+04',6);
524     INSERT INTO t1 VALUES('12.36E+',7);
525     INSERT INTO t1 VALUES('+123.10000E+0003',8);
526     INSERT INTO t1 VALUES('+',9);
527     INSERT INTO t1 VALUES('+12347.E+02',10);
528     INSERT INTO t1 VALUES('+12347E+02',11);
529     SELECT b FROM t1 ORDER BY a;
530   }
531 } {8 5 2 1 3 6 11 9 10 4 7}
532 integrity_check index-15.1
534 # The following tests - index-16.* - test that when a table definition
535 # includes qualifications that specify the same constraint twice only a
536 # single index is generated to enforce the constraint.
538 # For example: "CREATE TABLE abc( x PRIMARY KEY, UNIQUE(x) );"
540 do_test index-16.1 {
541   execsql {
542     CREATE TABLE t7(c UNIQUE PRIMARY KEY);
543     SELECT count(*) FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
544   }
545 } {1}
546 do_test index-16.2 {
547   execsql {
548     DROP TABLE t7;
549     CREATE TABLE t7(c UNIQUE PRIMARY KEY);
550     SELECT count(*) FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
551   }
552 } {1}
553 do_test index-16.3 {
554   execsql {
555     DROP TABLE t7;
556     CREATE TABLE t7(c PRIMARY KEY, UNIQUE(c) );
557     SELECT count(*) FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
558   }
559 } {1}
560 do_test index-16.4 {
561   execsql {
562     DROP TABLE t7;
563     CREATE TABLE t7(c, d , UNIQUE(c, d), PRIMARY KEY(c, d) );
564     SELECT count(*) FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
565   }
566 } {1}
567 do_test index-16.5 {
568   execsql {
569     DROP TABLE t7;
570     CREATE TABLE t7(c, d , UNIQUE(c), PRIMARY KEY(c, d) );
571     SELECT count(*) FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
572   }
573 } {2}
575 # Test that automatically create indices are named correctly. The current
576 # convention is: "sqlite_autoindex_<table name>_<integer>"
578 # Then check that it is an error to try to drop any automtically created
579 # indices.
580 do_test index-17.1 {
581   execsql {
582     DROP TABLE t7;
583     CREATE TABLE t7(c, d UNIQUE, UNIQUE(c), PRIMARY KEY(c, d) );
584     SELECT name FROM sqlite_master WHERE tbl_name = 't7' AND type = 'index';
585   }
586 } {sqlite_autoindex_t7_1 sqlite_autoindex_t7_2 sqlite_autoindex_t7_3}
587 do_test index-17.2 {
588   catchsql {
589     DROP INDEX sqlite_autoindex_t7_1;
590   }
591 } {1 {index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped}}
593 # The following tests ensure that it is not possible to explicitly name
594 # a schema object with a name beginning with "sqlite_". Granted that is a
595 # little outside the focus of this test scripts, but this has got to be
596 # tested somewhere.
597 do_test index-18.1 {
598   catchsql {
599     CREATE TABLE sqlite_t1(a, b, c);
600   }
601 } {1 {object name reserved for internal use: sqlite_t1}}
602 do_test index-18.2 {
603   catchsql {
604     CREATE INDEX sqlite_i1 ON t7(c);
605   }
606 } {1 {object name reserved for internal use: sqlite_i1}}
607 ifcapable view {
608 do_test index-18.3 {
609   catchsql {
610     CREATE VIEW sqlite_v1 AS SELECT * FROM t7;
611   }
612 } {1 {object name reserved for internal use: sqlite_v1}}
613 } ;# ifcapable view
614 ifcapable {trigger} {
615   do_test index-18.4 {
616     catchsql {
617       CREATE TRIGGER sqlite_tr1 BEFORE INSERT ON t7 BEGIN SELECT 1; END;
618     }
619   } {1 {object name reserved for internal use: sqlite_tr1}}
621 do_test index-18.5 {
622   execsql {
623     DROP TABLE t7;
624   }
625 } {}
627 # These tests ensure that if multiple table definition constraints are
628 # implemented by a single indice, the correct ON CONFLICT policy applies.
629 do_test index-19.1 {
630   execsql {
631     CREATE TABLE t7(a UNIQUE PRIMARY KEY);
632     CREATE TABLE t8(a UNIQUE PRIMARY KEY ON CONFLICT ROLLBACK);
633     INSERT INTO t7 VALUES(1);
634     INSERT INTO t8 VALUES(1);
635   }
636 } {}
637 do_test index-19.2 {
638   catchsql {
639     BEGIN;
640     INSERT INTO t7 VALUES(1);
641   }
642 } {1 {column a is not unique}}
643 do_test index-19.3 {
644   catchsql {
645     BEGIN;
646   }
647 } {1 {cannot start a transaction within a transaction}}
648 do_test index-19.4 {
649   catchsql {
650     INSERT INTO t8 VALUES(1);
651   }
652 } {1 {column a is not unique}}
653 do_test index-19.5 {
654   catchsql {
655     BEGIN;
656     COMMIT;
657   }
658 } {0 {}}
659 do_test index-19.6 {
660   catchsql {
661     DROP TABLE t7;
662     DROP TABLE t8;
663     CREATE TABLE t7(
664        a PRIMARY KEY ON CONFLICT FAIL, 
665        UNIQUE(a) ON CONFLICT IGNORE
666     );
667   }
668 } {1 {conflicting ON CONFLICT clauses specified}}
670 ifcapable {reindex} {
671   do_test index-19.7 {
672     execsql REINDEX
673   } {}
675 integrity_check index-19.8
677 # Drop index with a quoted name.  Ticket #695.
679 do_test index-20.1 {
680   execsql {
681     CREATE INDEX "t6i2" ON t6(c);
682     DROP INDEX "t6i2";
683   }
684 } {}
685 do_test index-20.2 {
686   execsql {
687     DROP INDEX "t6i1";
688   }
689 } {}
690    
692 finish_test