diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index a2c24611..259ba806 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -355,12 +355,12 @@ if (isset($_GET["pgsql"])) { return "(SELECT oid FROM pg_class WHERE relnamespace = $this->nsOid AND relname = " . q($table) . " AND relkind IN ('r', 'm', 'v', 'f', 'p'))"; } - function indexMethods(): array { - static $methods = array(); - if (!$methods) { - $methods = get_vals("SELECT amname FROM pg_am" . (min_version(9.6) ? " WHERE amtype = 'i'" : "") . " ORDER BY amname = 'btree' DESC, amname"); + function indexAlgorithms(array $tableStatus): array { + static $return = array(); + if (!$return) { + $return = get_vals("SELECT amname FROM pg_am" . (min_version(9.6) ? " WHERE amtype = 'i'" : "") . " ORDER BY amname = 'btree' DESC, amname"); } - return $methods; + return $return; } function supportsIndex(array $table_status): bool { diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 1f44018a..1000711e 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -348,9 +348,11 @@ class Adminer { /** Print list of indexes on table in tabular format * @param Index[] $indexes + * @param TableStatus $tableStatus */ - function tableIndexesPrint(array $indexes): void { + function tableIndexesPrint(array $indexes, array $tableStatus): void { echo "
$index[type]" . ($index['algorithm'] != first(driver()->indexMethods()) ? " ($index[algorithm])" : ""); + echo " | $index[type]" . ($index['algorithm'] != $default_algorithm ? " ($index[algorithm])" : ""); echo " | " . implode(", ", $print);
echo "\n";
}
diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php
index c7577a5b..8cf3b3db 100644
--- a/adminer/include/driver.inc.php
+++ b/adminer/include/driver.inc.php
@@ -259,10 +259,11 @@ abstract class SqlDriver {
}
/**
- * Return list of supported index methods, first one is default
+ * Return list of supported index algorithms, first one is default
+ * @param TableStatus $tableStatus
* @return list
indexMethods()) {
- echo " | " . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow.call(this);" : ""), "label-type");
- if (driver()->indexMethods()) {
- echo " | ";
diff --git a/adminer/table.inc.php b/adminer/table.inc.php
index a9846d37..66f6cfe0 100644
--- a/adminer/table.inc.php
+++ b/adminer/table.inc.php
@@ -42,7 +42,7 @@ if (support("indexes") && driver()->supportsIndex($table_status)) {
echo " | " . lang('Indexes') . "\n"; $indexes = indexes($TABLE); if ($indexes) { - adminer()->tableIndexesPrint($indexes); + adminer()->tableIndexesPrint($indexes, $table_status); } echo '' . lang('Alter indexes') . "\n"; } diff --git a/plugins/table-indexes-structure.php b/plugins/table-indexes-structure.php index 528adf10..5c3f7f92 100644 --- a/plugins/table-indexes-structure.php +++ b/plugins/table-indexes-structure.php @@ -8,10 +8,7 @@ */ class AdminerTableIndexesStructure extends Adminer\Plugin { - /** Print table structure in tabular format - * @param Index[] $indexes data about all indexes on a table - */ - function tableIndexesPrint($indexes): bool { + function tableIndexesPrint($indexes, $tableStatus): bool { echo "
|
---|