aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-08-19 14:20:56 +0000
committerdrh <drh@noemail.net>2016-08-19 14:20:56 +0000
commit9ef5e7708a4c37710d4093f7730141c842d1f643 (patch)
tree01cbfc0b580c31619949e141d90fc4baaab20867 /src/insert.c
parent61ea610cd0fe5ba28cbe3a67479d9177fe66daf5 (diff)
downloadsqlite-9ef5e7708a4c37710d4093f7730141c842d1f643.tar.gz
sqlite-9ef5e7708a4c37710d4093f7730141c842d1f643.zip
Add the capability to VACUUM an attached database by specifying the schema
name as an argument to the VACUUM command. Since version 2.0, VACUUM has accepted an argument which was silently ignored. Now it has meaning. FossilOrigin-Name: 29d63059b4d2bb612523ac55ebfef040d054a64f
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c
index dacd37c7f..caab0f1d6 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -200,7 +200,9 @@ static int readsTable(Parse *p, int iDb, Table *pTab){
/*
** Locate or create an AutoincInfo structure associated with table pTab
** which is in database iDb. Return the register number for the register
-** that holds the maximum rowid.
+** that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT
+** table. (Also return zero when doing a VACUUM since we do not want to
+** update the AUTOINCREMENT counters during a VACUUM.)
**
** There is at most one AutoincInfo structure per table even if the
** same table is autoincremented multiple times due to inserts within
@@ -223,7 +225,9 @@ static int autoIncBegin(
Table *pTab /* The table we are writing to */
){
int memId = 0; /* Register holding maximum rowid */
- if( pTab->tabFlags & TF_Autoincrement ){
+ if( (pTab->tabFlags & TF_Autoincrement)!=0
+ && (pParse->db->flags & SQLITE_Vacuum)==0
+ ){
Parse *pToplevel = sqlite3ParseToplevel(pParse);
AutoincInfo *pInfo;