mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 09:34:10 +02:00
PostgreSQL: Do not alter indexes with expressions
This commit is contained in:
@@ -423,12 +423,14 @@ ORDER BY a.attnum"
|
|||||||
$relname = $row["relname"];
|
$relname = $row["relname"];
|
||||||
$return[$relname]["type"] = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX")));
|
$return[$relname]["type"] = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX")));
|
||||||
$return[$relname]["columns"] = array();
|
$return[$relname]["columns"] = array();
|
||||||
foreach (explode(" ", $row["indkey"]) as $indkey) {
|
|
||||||
$return[$relname]["columns"][] = $columns[$indkey];
|
|
||||||
}
|
|
||||||
$return[$relname]["descs"] = array();
|
$return[$relname]["descs"] = array();
|
||||||
foreach (explode(" ", $row["indoption"]) as $indoption) {
|
if ($row["indkey"]) {
|
||||||
$return[$relname]["descs"][] = ($indoption & 1 ? '1' : null); // 1 - INDOPTION_DESC
|
foreach (explode(" ", $row["indkey"]) as $indkey) {
|
||||||
|
$return[$relname]["columns"][] = $columns[$indkey];
|
||||||
|
}
|
||||||
|
foreach (explode(" ", $row["indoption"]) as $indoption) {
|
||||||
|
$return[$relname]["descs"][] = ($indoption & 1 ? '1' : null); // 1 - INDOPTION_DESC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$return[$relname]["lengths"] = array();
|
$return[$relname]["lengths"] = array();
|
||||||
}
|
}
|
||||||
|
@@ -40,22 +40,22 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($columns) {
|
$existing = $indexes[$name];
|
||||||
$existing = $indexes[$name];
|
if ($existing) {
|
||||||
if ($existing) {
|
ksort($existing["columns"]);
|
||||||
ksort($existing["columns"]);
|
ksort($existing["lengths"]);
|
||||||
ksort($existing["lengths"]);
|
ksort($existing["descs"]);
|
||||||
ksort($existing["descs"]);
|
if ($index["type"] == $existing["type"]
|
||||||
if ($index["type"] == $existing["type"]
|
&& array_values($existing["columns"]) === $columns
|
||||||
&& array_values($existing["columns"]) === $columns
|
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
|
||||||
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
|
&& array_values($existing["descs"]) === $descs
|
||||||
&& array_values($existing["descs"]) === $descs
|
) {
|
||||||
) {
|
// skip existing index
|
||||||
// skip existing index
|
unset($indexes[$name]);
|
||||||
unset($indexes[$name]);
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if ($columns) {
|
||||||
$alter[] = array($index["type"], $name, $set);
|
$alter[] = array($index["type"], $name, $set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
Adminer dev:
|
Adminer dev:
|
||||||
|
PostgreSQL: Do not alter indexes with expressions
|
||||||
PostgreSQL: Fix export of indexes with expressions (bug #768)
|
PostgreSQL: Fix export of indexes with expressions (bug #768)
|
||||||
SQLite: Support CHECK constraint
|
SQLite: Support CHECK constraint
|
||||||
SQLite: Add command Check tables
|
SQLite: Add command Check tables
|
||||||
|
Reference in New Issue
Block a user