1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-15 11:04:02 +02:00

PostgreSQL: Support index algorithms

This commit is contained in:
salacr
2025-04-16 09:07:53 +02:00
committed by Jakub Vrana
parent 6d6998c3d3
commit 92ce506243
9 changed files with 42 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
$columns = array();
$lengths = array();
$descs = array();
$index_algorithm = (in_array($index["algorithm"], driver()->indexMethods()) ? $index["algorithm"] : "");
$set = array();
ksort($index["columns"]);
foreach ($index["columns"] as $key => $column) {
@@ -52,6 +53,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
&& array_values($existing["columns"]) === $columns
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
&& array_values($existing["descs"]) === $descs
&& $existing["algorithm"] === $index_algorithm
) {
// skip existing index
unset($indexes[$name]);
@@ -59,7 +61,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
}
}
if ($columns) {
$alter[] = array($index["type"], $name, $set);
$alter[] = array($index["type"], $name, $set, $index_algorithm);
}
}
}
@@ -105,6 +107,11 @@ $show_options = ($_POST ? $_POST["options"] : get_setting("index_options"));
<table class="nowrap">
<thead><tr>
<th id="label-type"><?php echo lang('Index Type'); ?>
<?php
if (driver()->indexMethods()) {
echo "<th id='label-method' class='idxopts" . ($show_options ? "" : " hidden") . "'>" . lang('Algorithm');
}
?>
<th><input type="submit" class="wayoff"><?php
echo lang('Columns') . ($lengths ? "<span class='idxopts" . ($show_options ? "" : " hidden") . "'> (" . lang('length') . ")</span>" : "");
if ($lengths || support("descidx")) {
@@ -128,6 +135,10 @@ foreach ($row["indexes"] as $index) {
if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow.call(this);" : ""), "label-type");
if (driver()->indexMethods()) {
echo "<td class='idxopts" . ($show_options ? "" : " hidden") . "'>" . html_select("indexes[$j][algorithm]", array_merge(array(""), driver()->indexMethods()), $index['algorithm'], "label-method");
}
echo "<td>";
ksort($index["columns"]);
$i = 1;