clarified "vacuum" (again, reverting 0bd366fad888);
authorwenzelm
Tue, 18 Jul 2023 12:32:07 +0200
changeset 78390 a84f8fca0833
parent 78389 41e8ae87184d
child 78391 e47233dbeab7
clarified "vacuum" (again, reverting 0bd366fad888);
src/Pure/General/sql.scala
--- a/src/Pure/General/sql.scala	Tue Jul 18 12:19:12 2023 +0200
+++ b/src/Pure/General/sql.scala	Tue Jul 18 12:32:07 2023 +0200
@@ -382,15 +382,12 @@
     def is_postgresql: Boolean = isInstanceOf[PostgreSQL.Database]
 
     def vacuum(tables: List[SQL.Table] = Nil): Unit =
-      if (tables.nonEmpty) {
-        postgresql_major_version match {
-          case Some(m) if m <= 10 =>
-            for (table <- tables) execute_statement("VACUUM " + table.ident)
-          case Some(_) =>
-            execute_statement("VACUUM" + commas(tables.map(_.ident)))
-          case None => execute_statement("VACUUM")
-        }
+      if (is_sqlite) execute_statement("VACUUM")  // always FULL
+      else if (tables.isEmpty) execute_statement("VACUUM FULL")
+      else if (postgresql_major_version.get <= 10) {
+        for (t <- tables) execute_statement("VACUUM " + t.ident)
       }
+      else execute_statement("VACUUM" + commas(tables.map(_.ident)))
 
     def now(): Date