Fossil SCM

Fix the rebuilder so that it does not try to drop shadow tables, which cannot be dropped in newer versions of SQLite, and thus does not error out for databases that have FTS indexes.

drh 2024-12-06 13:49 trunk
Commit 55f136610030f7e7204f8f0c2058ea943d964886adede2e652fdcfd0ffd76eac
2 files changed +5 -2 +2
+5 -2
--- src/merge.c
+++ src/merge.c
@@ -337,11 +337,14 @@
337337
/*
338338
** Erase all information about prior merges. Do this, for example, after
339339
** a commit.
340340
*/
341341
void merge_info_forget(void){
342
- db_multi_exec("DROP TABLE IF EXISTS localdb.mergestat");
342
+ db_multi_exec(
343
+ "DROP TABLE IF EXISTS localdb.mergestat;"
344
+ "DELETE FROM localdb.vvar WHERE name glob 'mergestat-*';"
345
+ );
343346
}
344347
345348
346349
/*
347350
** Initialize the MERGESTAT table.
@@ -355,12 +358,12 @@
355358
**
356359
** * fnp, ridp, fn, ridv, and sz are all NULL for a file that was
357360
** added by merge.
358361
*/
359362
void merge_info_init(void){
363
+ merge_info_forget();
360364
db_multi_exec(
361
- "DROP TABLE IF EXISTS localdb.mergestat;\n"
362365
"CREATE TABLE localdb.mergestat(\n"
363366
" op TEXT, -- 'UPDATE', 'ADDED', 'MERGE', etc...\n"
364367
" fnp TEXT, -- Name of the pivot file (P)\n"
365368
" ridp INT, -- RID for the pivot file\n"
366369
" fn TEXT, -- Name of origin file (V)\n"
367370
--- src/merge.c
+++ src/merge.c
@@ -337,11 +337,14 @@
337 /*
338 ** Erase all information about prior merges. Do this, for example, after
339 ** a commit.
340 */
341 void merge_info_forget(void){
342 db_multi_exec("DROP TABLE IF EXISTS localdb.mergestat");
 
 
 
343 }
344
345
346 /*
347 ** Initialize the MERGESTAT table.
@@ -355,12 +358,12 @@
355 **
356 ** * fnp, ridp, fn, ridv, and sz are all NULL for a file that was
357 ** added by merge.
358 */
359 void merge_info_init(void){
 
360 db_multi_exec(
361 "DROP TABLE IF EXISTS localdb.mergestat;\n"
362 "CREATE TABLE localdb.mergestat(\n"
363 " op TEXT, -- 'UPDATE', 'ADDED', 'MERGE', etc...\n"
364 " fnp TEXT, -- Name of the pivot file (P)\n"
365 " ridp INT, -- RID for the pivot file\n"
366 " fn TEXT, -- Name of origin file (V)\n"
367
--- src/merge.c
+++ src/merge.c
@@ -337,11 +337,14 @@
337 /*
338 ** Erase all information about prior merges. Do this, for example, after
339 ** a commit.
340 */
341 void merge_info_forget(void){
342 db_multi_exec(
343 "DROP TABLE IF EXISTS localdb.mergestat;"
344 "DELETE FROM localdb.vvar WHERE name glob 'mergestat-*';"
345 );
346 }
347
348
349 /*
350 ** Initialize the MERGESTAT table.
@@ -355,12 +358,12 @@
358 **
359 ** * fnp, ridp, fn, ridv, and sz are all NULL for a file that was
360 ** added by merge.
361 */
362 void merge_info_init(void){
363 merge_info_forget();
364 db_multi_exec(
 
365 "CREATE TABLE localdb.mergestat(\n"
366 " op TEXT, -- 'UPDATE', 'ADDED', 'MERGE', etc...\n"
367 " fnp TEXT, -- Name of the pivot file (P)\n"
368 " ridp INT, -- RID for the pivot file\n"
369 " fn TEXT, -- Name of origin file (V)\n"
370
--- src/rebuild.c
+++ src/rebuild.c
@@ -400,10 +400,12 @@
400400
"'concealed','accesslog','modreq',"
401401
"'purgeevent','purgeitem','unversioned',"
402402
"'subscriber','pending_alert','chat')"
403403
" AND name NOT GLOB 'sqlite_*'"
404404
" AND name NOT GLOB 'fx_*'"
405
+ " AND name NOT GLOB 'ftsidx_*'"
406
+ " AND name NOT GLOB 'chatfts1_*'"
405407
);
406408
while( db_step(&q)==SQLITE_ROW ){
407409
blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
408410
}
409411
db_finalize(&q);
410412
--- src/rebuild.c
+++ src/rebuild.c
@@ -400,10 +400,12 @@
400 "'concealed','accesslog','modreq',"
401 "'purgeevent','purgeitem','unversioned',"
402 "'subscriber','pending_alert','chat')"
403 " AND name NOT GLOB 'sqlite_*'"
404 " AND name NOT GLOB 'fx_*'"
 
 
405 );
406 while( db_step(&q)==SQLITE_ROW ){
407 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
408 }
409 db_finalize(&q);
410
--- src/rebuild.c
+++ src/rebuild.c
@@ -400,10 +400,12 @@
400 "'concealed','accesslog','modreq',"
401 "'purgeevent','purgeitem','unversioned',"
402 "'subscriber','pending_alert','chat')"
403 " AND name NOT GLOB 'sqlite_*'"
404 " AND name NOT GLOB 'fx_*'"
405 " AND name NOT GLOB 'ftsidx_*'"
406 " AND name NOT GLOB 'chatfts1_*'"
407 );
408 while( db_step(&q)==SQLITE_ROW ){
409 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
410 }
411 db_finalize(&q);
412

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button