Permalink
Browse files

Vacuum for PostgreSQL

  • Loading branch information...
1 parent a25fa67 commit 4cc29e01370d21b2f9c6673151876c28bea5456a @vrana committed Mar 1, 2012
Showing with 7 additions and 4 deletions.
  1. +6 −3 adminer/db.inc.php
  2. +1 −1 changes.txt
View
@@ -26,8 +26,11 @@
$result = drop_tables($_POST["tables"]);
}
$message = lang('Tables have been dropped.');
- } elseif ($jush == "sqlite") {
- $result = queries("VACUUM");
+ } elseif ($jush != "sql") {
+ $result = ($jush == "sqlite"
+ ? queries("VACUUM")
+ : apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"])
+ );
$message = lang('Tables have been optimized.');
} elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) {
while ($row = $result->fetch_assoc()) {
@@ -94,7 +97,7 @@
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
if (!information_schema(DB)) {
- echo "<p>" . (ereg('^(sql|sqlite)$', $jush)
+ echo "<p>" . (ereg('^(sql|sqlite|pgsql)$', $jush)
? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "")
. "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : ""
) . ($jush == "sql" ? "<input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
View
@@ -11,7 +11,7 @@ Don't quote bit type in export
Ability to disable export (customization)
Extensible list of databases (customization)
MySQL: set autocommit after connect
-SQLite: vacuum
+SQLite, PostgreSQL: vacuum
PostgreSQL: fix alter foreign key
PostgreSQL, SQLite: don't use LIKE for numbers (bug #3420408)
PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619)

0 comments on commit 4cc29e0

Please sign in to comment.