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 script is testing the AUTOINCREMENT features.
14 # $Id: autoinc.test,v 1.14 2009/06/23 20:28:54 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 # If the library is not compiled with autoincrement support then
21 # skip all tests in this file.
23 ifcapable {!autoinc} {
28 if {[permutation]=="inmemory_journal"} {
33 sqlite3_db_config_lookaside db 0 0 0
35 # The database is initially empty.
39 SELECT name FROM sqlite_master WHERE type='table';
43 # Add a table with the AUTOINCREMENT feature. Verify that the
44 # SQLITE_SEQUENCE table gets created.
48 CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
49 SELECT name FROM sqlite_master WHERE type='table';
51 } {t1 sqlite_sequence}
53 # The SQLITE_SEQUENCE table is initially empty
57 SELECT * FROM sqlite_sequence;
60 do_test autoinc-1.3.1 {
62 CREATE INDEX seqidx ON sqlite_sequence(name)
64 } {1 {table sqlite_sequence may not be indexed}}
66 # Close and reopen the database. Verify that everything is still there.
72 SELECT * FROM sqlite_sequence;
76 # We are not allowed to drop the sqlite_sequence table.
79 catchsql {DROP TABLE sqlite_sequence}
80 } {1 {table sqlite_sequence may not be dropped}}
82 execsql {SELECT name FROM sqlite_master WHERE type='table'}
83 } {t1 sqlite_sequence}
85 # Insert an entries into the t1 table and make sure the largest key
86 # is always recorded in the sqlite_sequence table.
90 SELECT * FROM sqlite_sequence
95 INSERT INTO t1 VALUES(12,34);
96 SELECT * FROM sqlite_sequence;
101 INSERT INTO t1 VALUES(1,23);
102 SELECT * FROM sqlite_sequence;
105 do_test autoinc-2.4 {
107 INSERT INTO t1 VALUES(123,456);
108 SELECT * FROM sqlite_sequence;
111 do_test autoinc-2.5 {
113 INSERT INTO t1 VALUES(NULL,567);
114 SELECT * FROM sqlite_sequence;
117 do_test autoinc-2.6 {
119 DELETE FROM t1 WHERE y=567;
120 SELECT * FROM sqlite_sequence;
123 do_test autoinc-2.7 {
125 INSERT INTO t1 VALUES(NULL,567);
126 SELECT * FROM sqlite_sequence;
129 do_test autoinc-2.8 {
132 SELECT * FROM sqlite_sequence;
135 do_test autoinc-2.9 {
137 INSERT INTO t1 VALUES(12,34);
138 SELECT * FROM sqlite_sequence;
141 do_test autoinc-2.10 {
143 INSERT INTO t1 VALUES(125,456);
144 SELECT * FROM sqlite_sequence;
147 do_test autoinc-2.11 {
149 INSERT INTO t1 VALUES(-1234567,-1);
150 SELECT * FROM sqlite_sequence;
153 do_test autoinc-2.12 {
155 INSERT INTO t1 VALUES(234,5678);
156 SELECT * FROM sqlite_sequence;
159 do_test autoinc-2.13 {
162 INSERT INTO t1 VALUES(NULL,1);
163 SELECT * FROM sqlite_sequence;
166 do_test autoinc-2.14 {
172 # Manually change the autoincrement values in sqlite_sequence.
174 do_test autoinc-2.20 {
176 UPDATE sqlite_sequence SET seq=1234 WHERE name='t1';
177 INSERT INTO t1 VALUES(NULL,2);
181 do_test autoinc-2.21 {
183 SELECT * FROM sqlite_sequence;
186 do_test autoinc-2.22 {
188 UPDATE sqlite_sequence SET seq=NULL WHERE name='t1';
189 INSERT INTO t1 VALUES(NULL,3);
192 } {235 1 1235 2 1236 3}
193 do_test autoinc-2.23 {
195 SELECT * FROM sqlite_sequence;
198 do_test autoinc-2.24 {
200 UPDATE sqlite_sequence SET seq='a-string' WHERE name='t1';
201 INSERT INTO t1 VALUES(NULL,4);
204 } {235 1 1235 2 1236 3 1237 4}
205 do_test autoinc-2.25 {
207 SELECT * FROM sqlite_sequence;
210 do_test autoinc-2.26 {
212 DELETE FROM sqlite_sequence WHERE name='t1';
213 INSERT INTO t1 VALUES(NULL,5);
216 } {235 1 1235 2 1236 3 1237 4 1238 5}
217 do_test autoinc-2.27 {
219 SELECT * FROM sqlite_sequence;
222 do_test autoinc-2.28 {
224 UPDATE sqlite_sequence SET seq='-12345678901234567890'
226 INSERT INTO t1 VALUES(NULL,6);
229 } {235 1 1235 2 1236 3 1237 4 1238 5 1239 6}
230 do_test autoinc-2.29 {
232 SELECT * FROM sqlite_sequence;
236 # Test multi-row inserts
238 do_test autoinc-2.50 {
240 DELETE FROM t1 WHERE y>=3;
241 INSERT INTO t1 SELECT NULL, y+2 FROM t1;
244 } {235 1 1235 2 1240 3 1241 4}
245 do_test autoinc-2.51 {
247 SELECT * FROM sqlite_sequence
252 do_test autoinc-2.52 {
254 CREATE TEMP TABLE t2 AS SELECT y FROM t1;
257 INSERT INTO t1 SELECT NULL, y+4 FROM t2;
260 } {235 1 1235 2 1240 3 1241 4 1242 5 1243 6 1244 7 1245 8}
261 do_test autoinc-2.53 {
263 SELECT * FROM sqlite_sequence
266 do_test autoinc-2.54 {
269 INSERT INTO t1 SELECT NULL, y FROM t2;
272 } {1246 1 1247 2 1248 3 1249 4}
273 do_test autoinc-2.55 {
275 SELECT * FROM sqlite_sequence
280 # Create multiple AUTOINCREMENT tables. Make sure all sequences are
281 # tracked separately and do not interfere with one another.
283 do_test autoinc-2.70 {
288 CREATE TABLE t2(d, e INTEGER PRIMARY KEY AUTOINCREMENT, f);
289 INSERT INTO t2(d) VALUES(1);
290 SELECT * FROM sqlite_sequence;
292 } [ifcapable tempdb {list t1 1249 t2 1} else {list t1 1241 t2 1}]
293 do_test autoinc-2.71 {
295 INSERT INTO t2(d) VALUES(2);
296 SELECT * FROM sqlite_sequence;
298 } [ifcapable tempdb {list t1 1249 t2 2} else {list t1 1241 t2 2}]
299 do_test autoinc-2.72 {
301 INSERT INTO t1(x) VALUES(10000);
302 SELECT * FROM sqlite_sequence;
305 do_test autoinc-2.73 {
307 CREATE TABLE t3(g INTEGER PRIMARY KEY AUTOINCREMENT, h);
308 INSERT INTO t3(h) VALUES(1);
309 SELECT * FROM sqlite_sequence;
311 } {t1 10000 t2 2 t3 1}
312 do_test autoinc-2.74 {
314 INSERT INTO t2(d,e) VALUES(3,100);
315 SELECT * FROM sqlite_sequence;
317 } {t1 10000 t2 100 t3 1}
320 # When a table with an AUTOINCREMENT is deleted, the corresponding entry
321 # in the SQLITE_SEQUENCE table should also be deleted. But the SQLITE_SEQUENCE
322 # table itself should remain behind.
324 do_test autoinc-3.1 {
325 execsql {SELECT name FROM sqlite_sequence}
327 do_test autoinc-3.2 {
330 SELECT name FROM sqlite_sequence;
333 do_test autoinc-3.3 {
336 SELECT name FROM sqlite_sequence;
339 do_test autoinc-3.4 {
342 SELECT name FROM sqlite_sequence;
346 # AUTOINCREMENT on TEMP tables.
349 do_test autoinc-4.1 {
351 SELECT 1, name FROM sqlite_master WHERE type='table';
352 SELECT 2, name FROM temp.sqlite_master WHERE type='table';
354 } {1 sqlite_sequence}
355 do_test autoinc-4.2 {
357 CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
358 CREATE TEMP TABLE t3(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
359 SELECT 1, name FROM sqlite_master WHERE type='table';
360 SELECT 2, name FROM sqlite_temp_master WHERE type='table';
362 } {1 sqlite_sequence 1 t1 2 t3 2 sqlite_sequence}
363 do_test autoinc-4.3 {
365 SELECT 1, * FROM main.sqlite_sequence;
366 SELECT 2, * FROM temp.sqlite_sequence;
369 do_test autoinc-4.4 {
371 INSERT INTO t1 VALUES(10,1);
372 INSERT INTO t3 VALUES(20,2);
373 INSERT INTO t1 VALUES(NULL,3);
374 INSERT INTO t3 VALUES(NULL,4);
379 do_test autoinc-4.4.1 {
381 SELECT * FROM t1 UNION ALL SELECT * FROM t3;
383 } {10 1 11 3 20 2 21 4}
384 } ;# ifcapable compound
386 do_test autoinc-4.5 {
388 SELECT 1, * FROM main.sqlite_sequence;
389 SELECT 2, * FROM temp.sqlite_sequence;
392 do_test autoinc-4.6 {
394 INSERT INTO t1 SELECT * FROM t3;
395 SELECT 1, * FROM main.sqlite_sequence;
396 SELECT 2, * FROM temp.sqlite_sequence;
399 do_test autoinc-4.7 {
401 INSERT INTO t3 SELECT x+100, y FROM t1;
402 SELECT 1, * FROM main.sqlite_sequence;
403 SELECT 2, * FROM temp.sqlite_sequence;
406 do_test autoinc-4.8 {
409 SELECT 1, * FROM main.sqlite_sequence;
410 SELECT 2, * FROM temp.sqlite_sequence;
413 do_test autoinc-4.9 {
415 CREATE TEMP TABLE t2(p INTEGER PRIMARY KEY AUTOINCREMENT, q);
416 INSERT INTO t2 SELECT * FROM t1;
418 SELECT 1, * FROM main.sqlite_sequence;
419 SELECT 2, * FROM temp.sqlite_sequence;
422 do_test autoinc-4.10 {
425 SELECT 1, * FROM main.sqlite_sequence;
426 SELECT 2, * FROM temp.sqlite_sequence;
431 # Make sure AUTOINCREMENT works on ATTACH-ed tables.
433 ifcapable tempdb&&attach {
434 do_test autoinc-5.1 {
436 forcedelete test2.db-journal
439 CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n);
440 CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT);
443 ATTACH 'test2.db' as aux;
444 SELECT 1, * FROM main.sqlite_sequence;
445 SELECT 2, * FROM temp.sqlite_sequence;
446 SELECT 3, * FROM aux.sqlite_sequence;
449 do_test autoinc-5.2 {
451 INSERT INTO t4 VALUES(NULL,1);
452 SELECT 1, * FROM main.sqlite_sequence;
453 SELECT 2, * FROM temp.sqlite_sequence;
454 SELECT 3, * FROM aux.sqlite_sequence;
457 do_test autoinc-5.3 {
459 INSERT INTO t5 VALUES(100,200);
460 SELECT * FROM sqlite_sequence
463 do_test autoinc-5.4 {
465 SELECT 1, * FROM main.sqlite_sequence;
466 SELECT 2, * FROM temp.sqlite_sequence;
467 SELECT 3, * FROM aux.sqlite_sequence;
472 # Requirement REQ00310: Make sure an insert fails if the sequence is
473 # already at its maximum value.
475 ifcapable {rowid32} {
476 do_test autoinc-6.1 {
478 CREATE TABLE t6(v INTEGER PRIMARY KEY AUTOINCREMENT, w);
479 INSERT INTO t6 VALUES(2147483647,1);
480 SELECT seq FROM main.sqlite_sequence WHERE name='t6';
484 ifcapable {!rowid32} {
485 do_test autoinc-6.1 {
487 CREATE TABLE t6(v INTEGER PRIMARY KEY AUTOINCREMENT, w);
488 INSERT INTO t6 VALUES(9223372036854775807,1);
489 SELECT seq FROM main.sqlite_sequence WHERE name='t6';
491 } 9223372036854775807
493 do_test autoinc-6.2 {
495 INSERT INTO t6 VALUES(NULL,1);
497 } {1 {database or disk is full}}
499 # Allow the AUTOINCREMENT keyword inside the parentheses
500 # on a separate PRIMARY KEY designation.
502 do_test autoinc-7.1 {
504 CREATE TABLE t7(x INTEGER, y REAL, PRIMARY KEY(x AUTOINCREMENT));
505 INSERT INTO t7(y) VALUES(123);
506 INSERT INTO t7(y) VALUES(234);
508 INSERT INTO t7(y) VALUES(345);
513 # Test that if the AUTOINCREMENT is applied to a non integer primary key
514 # the error message is sensible.
515 do_test autoinc-7.2 {
517 CREATE TABLE t8(x TEXT PRIMARY KEY AUTOINCREMENT);
519 } {1 {AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY}}
522 # Ticket #1283. Make sure that preparing but never running a statement
523 # that creates the sqlite_sequence table does not mess up the database.
525 do_test autoinc-8.1 {
530 set DB [sqlite3_connection_pointer db]
531 set STMT [sqlite3_prepare $DB {
533 x INTEGER PRIMARY KEY AUTOINCREMENT
536 sqlite3_finalize $STMT
537 set STMT [sqlite3_prepare $DB {
539 x INTEGER PRIMARY KEY AUTOINCREMENT
543 sqlite3_finalize $STMT
545 INSERT INTO t1 VALUES(NULL);
551 # Make sure the sqlite_sequence table is not damaged when doing
552 # an empty insert - an INSERT INTO ... SELECT ... where the SELECT
553 # clause returns an empty set.
555 do_test autoinc-9.1 {
557 CREATE TABLE t2(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
558 INSERT INTO t2 VALUES(NULL, 1);
559 CREATE TABLE t3(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
560 INSERT INTO t3 SELECT * FROM t2 WHERE y>1;
562 SELECT * FROM sqlite_sequence WHERE name='t3';
567 catchsql { pragma recursive_triggers = off }
569 # Ticket #3928. Make sure that triggers to not make extra slots in
570 # the SQLITE_SEQUENCE table.
572 do_test autoinc-3928.1 {
574 CREATE TABLE t3928(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
575 CREATE TRIGGER t3928r1 BEFORE INSERT ON t3928 BEGIN
576 INSERT INTO t3928(b) VALUES('before1');
577 INSERT INTO t3928(b) VALUES('before2');
579 CREATE TRIGGER t3928r2 AFTER INSERT ON t3928 BEGIN
580 INSERT INTO t3928(b) VALUES('after1');
581 INSERT INTO t3928(b) VALUES('after2');
583 INSERT INTO t3928(b) VALUES('test');
584 SELECT * FROM t3928 ORDER BY a;
586 } {1 before1 2 after1 3 after2 4 before2 5 after1 6 after2 7 test 8 before1 9 before2 10 after1 11 before1 12 before2 13 after2}
587 do_test autoinc-3928.2 {
589 SELECT * FROM sqlite_sequence WHERE name='t3928'
593 do_test autoinc-3928.3 {
595 DROP TRIGGER t3928r1;
596 DROP TRIGGER t3928r2;
597 CREATE TRIGGER t3928r3 BEFORE UPDATE ON t3928
598 WHEN typeof(new.b)=='integer' BEGIN
599 INSERT INTO t3928(b) VALUES('before-int-' || new.b);
601 CREATE TRIGGER t3928r4 AFTER UPDATE ON t3928
602 WHEN typeof(new.b)=='integer' BEGIN
603 INSERT INTO t3928(b) VALUES('after-int-' || new.b);
605 DELETE FROM t3928 WHERE a!=1;
606 UPDATE t3928 SET b=456 WHERE a=1;
607 SELECT * FROM t3928 ORDER BY a;
609 } {1 456 14 before-int-456 15 after-int-456}
610 do_test autoinc-3928.4 {
612 SELECT * FROM sqlite_sequence WHERE name='t3928'
616 do_test autoinc-3928.5 {
618 CREATE TABLE t3928b(x);
619 INSERT INTO t3928b VALUES(100);
620 INSERT INTO t3928b VALUES(200);
621 INSERT INTO t3928b VALUES(300);
623 CREATE TABLE t3928c(y INTEGER PRIMARY KEY AUTOINCREMENT, z);
624 CREATE TRIGGER t3928br1 BEFORE DELETE ON t3928b BEGIN
625 INSERT INTO t3928(b) VALUES('before-del-'||old.x);
626 INSERT INTO t3928c(z) VALUES('before-del-'||old.x);
628 CREATE TRIGGER t3928br2 AFTER DELETE ON t3928b BEGIN
629 INSERT INTO t3928(b) VALUES('after-del-'||old.x);
630 INSERT INTO t3928c(z) VALUES('after-del-'||old.x);
633 SELECT * FROM t3928 ORDER BY a;
635 } {16 before-del-100 17 after-del-100 18 before-del-200 19 after-del-200 20 before-del-300 21 after-del-300}
636 do_test autoinc-3928.6 {
638 SELECT * FROM t3928c ORDER BY y;
640 } {1 before-del-100 2 after-del-100 3 before-del-200 4 after-del-200 5 before-del-300 6 after-del-300}
641 do_test autoinc-3928.7 {
643 SELECT * FROM sqlite_sequence WHERE name LIKE 't3928%' ORDER BY name;
645 } {t3928 21 t3928c 6}
647 # Ticket [a696379c1f0886615541a48b35bd8181a80e88f8]
648 do_test autoinc-a69637.1 {
650 CREATE TABLE ta69637_1(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
651 CREATE TABLE ta69637_2(z);
652 CREATE TRIGGER ra69637_1 AFTER INSERT ON ta69637_2 BEGIN
653 INSERT INTO ta69637_1(y) VALUES(new.z+1);
655 INSERT INTO ta69637_2 VALUES(123);
656 SELECT * FROM ta69637_1;
659 do_test autoinc-a69637.2 {
661 CREATE VIEW va69637_2 AS SELECT * FROM ta69637_2;
662 CREATE TRIGGER ra69637_2 INSTEAD OF INSERT ON va69637_2 BEGIN
663 INSERT INTO ta69637_1(y) VALUES(new.z+10000);
665 INSERT INTO va69637_2 VALUES(123);
666 SELECT * FROM ta69637_1;
671 # 2016-10-03 ticket https://www.sqlite.org/src/tktview/7b3328086a5c1
672 # Make sure autoincrement plays nicely with the xfer optimization
674 do_execsql_test autoinc-10.1 {
675 DELETE FROM sqlite_sequence;
676 CREATE TABLE t10a(a INTEGER PRIMARY KEY AUTOINCREMENT, b UNIQUE);
677 INSERT INTO t10a VALUES(888,9999);
678 CREATE TABLE t10b(x INTEGER PRIMARY KEY AUTOINCREMENT, y UNIQUE);
679 INSERT INTO t10b SELECT * FROM t10a;
680 SELECT * FROM sqlite_sequence;
681 } {t10a 888 t10b 888}
683 # 2018-04-21 autoincrement does not cause problems for upsert
685 do_execsql_test autoinc-11.1 {
686 CREATE TABLE t11(a INTEGER PRIMARY KEY AUTOINCREMENT,b UNIQUE);
687 INSERT INTO t11(a,b) VALUES(2,3),(5,6),(4,3),(1,2)
688 ON CONFLICT(b) DO UPDATE SET a=a+1000;
689 SELECT seq FROM sqlite_sequence WHERE name='t11';
692 # 2018-05-23 ticket d8dc2b3a58cd5dc2918a1d4acbba4676a23ada4c
693 # Does not crash if the sqlite_sequence table schema is missing
696 do_test autoinc-12.1 {
701 CREATE TABLE fake_sequence(name TEXT PRIMARY KEY,seq) WITHOUT ROWID;
702 PRAGMA writable_schema=on;
703 UPDATE sqlite_master SET
704 sql=replace(sql,'fake_','sqlite_'),
705 name='sqlite_sequence',
706 tbl_name='sqlite_sequence'
707 WHERE name='fake_sequence';
711 set res [catch {db eval {
712 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
713 INSERT INTO t1(b) VALUES('one');
716 } {1 {database disk image is malformed}}
717 do_test autoinc-12.2 {
722 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
723 INSERT INTO t1(b) VALUES('one');
724 PRAGMA writable_schema=on;
725 UPDATE sqlite_master SET
726 sql=replace(sql,'sqlite_','x_'),
728 tbl_name='x_sequence'
729 WHERE name='sqlite_sequence';
733 set res [catch {db eval {
734 INSERT INTO t1(b) VALUES('two');
737 } {1 {database disk image is malformed}}
739 set err "database disk image is malformed"
741 set err {malformed database schema (sqlite_sequence) - near "VIRTUAL": syntax error}
743 do_test autoinc-12.3 {
748 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
749 INSERT INTO t1(b) VALUES('one');
750 PRAGMA writable_schema=on;
751 UPDATE sqlite_master SET
752 sql='CREATE VIRTUAL TABLE sqlite_sequence USING sqlite_dbpage'
753 WHERE name='sqlite_sequence';
757 set res [catch {db eval {
758 INSERT INTO t1(b) VALUES('two');
762 do_test autoinc-12.4 {
767 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
768 INSERT INTO t1(b) VALUES('one');
769 CREATE TABLE fake(name TEXT PRIMARY KEY,seq) WITHOUT ROWID;
771 set root1 [db one {SELECT rootpage FROM sqlite_master
772 WHERE name='sqlite_sequence'}]
773 set root2 [db one {SELECT rootpage FROM sqlite_master
776 PRAGMA writable_schema=on;
777 UPDATE sqlite_master SET rootpage=$root2
778 WHERE name='sqlite_sequence';
779 UPDATE sqlite_master SET rootpage=$root1
784 set res [catch {db eval {
785 INSERT INTO t1(b) VALUES('two');
788 } {1 {database disk image is malformed}}
790 do_test autoinc-12.5 {
795 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
796 INSERT INTO t1(b) VALUES('one');
797 PRAGMA writable_schema=on;
798 UPDATE sqlite_master SET
799 sql='CREATE TABLE sqlite_sequence(x)'
800 WHERE name='sqlite_sequence';
804 set res [catch {db eval {
805 INSERT INTO t1(b) VALUES('two');
808 } {1 {database disk image is malformed}}
809 do_test autoinc-12.6 {
814 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
815 INSERT INTO t1(b) VALUES('one');
816 PRAGMA writable_schema=on;
817 UPDATE sqlite_master SET
818 sql='CREATE TABLE sqlite_sequence(x,y INTEGER PRIMARY KEY)'
819 WHERE name='sqlite_sequence';
823 set res [catch {db eval {
824 INSERT INTO t1(b) VALUES('two'),('three'),('four');
825 INSERT INTO t1(b) VALUES('five');
826 PRAGMA integrity_check;
830 do_test autoinc-12.7 {
835 CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b TEXT);
836 INSERT INTO t1(b) VALUES('one');
837 PRAGMA writable_schema=on;
838 UPDATE sqlite_master SET
839 sql='CREATE TABLE sqlite_sequence(y INTEGER PRIMARY KEY,x)'
840 WHERE name='sqlite_sequence';
844 set res [catch {db eval {
845 INSERT INTO t1(b) VALUES('two'),('three'),('four');
846 INSERT INTO t1(b) VALUES('five');
847 PRAGMA integrity_check;