From 0f68fd1bd92f0221e73ce7b7923dbd69bf23b5cc Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 16 Feb 2005 03:27:04 +0000 Subject: [PATCH] Get vacuum working on database that used to have autoincrement tables but where all such tables have been dropped. Ticket #1121. (CVS 2344) FossilOrigin-Name: 8f7c639da0f862fa2dd2f55eb7e4d453cd321540 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/vacuum.c | 6 +++--- test/vacuum2.test | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 test/vacuum2.test diff --git a/manifest b/manifest index f7f64c0afc..db148eea08 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sthe\sspecial\sbuilt-in\sSQL\sfunctions\sused\sby\sALTER\sTABLE\sout\sof\sfunc.c\nand\sinto\salter.c.\s(CVS\s2343) -D 2005-02-15T21:36:18 +C Get\svacuum\sworking\son\sdatabase\sthat\sused\sto\shave\sautoincrement\stables\sbut\r\nwhere\sall\ssuch\stables\shave\sbeen\sdropped.\s\sTicket\s#1121.\s(CVS\s2344) +D 2005-02-16T03:27:05 F Makefile.in 76443a83549d1539105e12d13bd0054a05ab2214 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -74,7 +74,7 @@ F src/trigger.c 038c8e128d4551cd016426cd11bbf5c478816481 F src/update.c b6f4668c11059f86b71581187d09197fa28ec4be F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c F src/util.c 1b7b9a127b66743ab6cba8d44597aeb570723c99 -F src/vacuum.c ccb34e92fd662b2d975e3c8d8cfd229c9081cb78 +F src/vacuum.c 5cf598003191bd91c17a64742bad8e46241698a8 F src/vdbe.c d9ec62c9f63768b4d4f8513b25aded8faf2de17b F src/vdbe.h bb9186484f749a839c6c43953e79a6530253f7cd F src/vdbeInt.h e80721cd8ff611789e20743eec43363a9fb5a48e @@ -207,6 +207,7 @@ F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558 F test/vacuum.test 76c4bc4589353d071e81c003a25338d02560474d +F test/vacuum2.test 5d77e98c458bcdbeecc6327de5107179ba1aa095 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/view.test 306cc4342eb03c28de1a92c681836189e03e5af9 F test/where.test ffb790dfda75d977bae7a1f5830351623f76861b @@ -272,7 +273,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl 3e522a06ad41992023c80ca29a048ae2331ca5bd -P 90d6573c2631fac92b9e572e9e21698ae2480c9d -R 384fca8815ea2fd0b9f2d663a9b9c24b +P dbd11a0c581b447bb2f220a1a185d9fd36933ee3 +R 3e933ca53eeeb55c0d837e7fbde35ff0 U drh -Z 4a0adb18d6e3aab9863249bdabd00180 +Z 495b7f43a6bd00411892cdab27def873 diff --git a/manifest.uuid b/manifest.uuid index 3af70d0265..cf0e00806d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dbd11a0c581b447bb2f220a1a185d9fd36933ee3 \ No newline at end of file +8f7c639da0f862fa2dd2f55eb7e4d453cd321540 \ No newline at end of file diff --git a/src/vacuum.c b/src/vacuum.c index 4444195bad..e1819315ab 100644 --- a/src/vacuum.c +++ b/src/vacuum.c @@ -14,7 +14,7 @@ ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** -** $Id: vacuum.c,v 1.39 2005/02/12 00:19:30 drh Exp $ +** $Id: vacuum.c,v 1.40 2005/02/16 03:27:05 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -211,13 +211,13 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ */ rc = execExecSql(db, "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' " - "FROM sqlite_master WHERE name='sqlite_sequence' " + "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' " ); if( rc!=SQLITE_OK ) goto end_of_vacuum; rc = execExecSql(db, "SELECT 'INSERT INTO vacuum_db.' || quote(name) " "|| ' SELECT * FROM ' || quote(name) || ';' " - "FROM sqlite_master WHERE name=='sqlite_sequence';" + "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';" ); if( rc!=SQLITE_OK ) goto end_of_vacuum; diff --git a/test/vacuum2.test b/test/vacuum2.test new file mode 100644 index 0000000000..1693cbbced --- /dev/null +++ b/test/vacuum2.test @@ -0,0 +1,42 @@ +# 2005 February 15 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this file is testing the VACUUM statement. +# +# $Id: vacuum2.test,v 1.1 2005/02/16 03:27:08 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# If the VACUUM statement is disabled in the current build, skip all +# the tests in this file. +# +ifcapable {!vacuum} { + finish_test + return +} +if $AUTOVACUUM { + finish_test + return +} + +# Ticket #1121 - make sure vacuum works if all autoincrement tables +# have been deleted. +# +do_test vacuum2-1.1 { + execsql { + CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y); + DROP TABLE t1; + VACUUM; + } +} {} + +finish_test