1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

PostgreSQL: Fix help link to pg_catalog views

This commit is contained in:
Jakub Vrana
2025-02-26 19:21:13 +01:00
parent 4b47326ffa
commit ba70be12a4
5 changed files with 10 additions and 7 deletions

View File

@@ -335,7 +335,7 @@ if (!defined("DRIVER")) {
} }
} }
function tableHelp($name) { function tableHelp($name, $is_view = false) {
$maria = preg_match('~MariaDB~', $this->_conn->server_info); $maria = preg_match('~MariaDB~', $this->_conn->server_info);
if (information_schema(DB)) { if (information_schema(DB)) {
return strtolower("information-schema-" . ($maria ? "$name-table/" : str_replace("_", "-", $name) . "-table.html")); return strtolower("information-schema-" . ($maria ? "$name-table/" : str_replace("_", "-", $name) . "-table.html"));

View File

@@ -238,10 +238,10 @@ if (isset($_GET["pgsql"])) {
return $this->_conn->warnings(); return $this->_conn->warnings();
} }
function tableHelp($name) { function tableHelp($name, $is_view = false) {
$links = array( $links = array(
"information_schema" => "infoschema", "information_schema" => "infoschema",
"pg_catalog" => "catalog", "pg_catalog" => ($is_view ? "view" : "catalog"),
); );
$link = $links[$_GET["ns"]]; $link = $links[$_GET["ns"]];
if ($link) { if ($link) {

View File

@@ -130,7 +130,7 @@ if (isset($_GET["sqlite"])) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values)); return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values));
} }
function tableHelp($name) { function tableHelp($name, $is_view = false) {
if ($name == "sqlite_sequence") { if ($name == "sqlite_sequence") {
return "fileformat2.html#seqtab"; return "fileformat2.html#seqtab";
} }

View File

@@ -180,8 +180,10 @@ class Adminer {
if (support("table") || support("indexes")) { if (support("table") || support("indexes")) {
$links["table"] = lang('Show structure'); $links["table"] = lang('Show structure');
} }
$is_view = false;
if (support("table")) { if (support("table")) {
if (is_view($tableStatus)) { $is_view = is_view($tableStatus);
if ($is_view) {
$links["view"] = lang('Alter view'); $links["view"] = lang('Alter view');
} else { } else {
$links["create"] = lang('Alter table'); $links["create"] = lang('Alter table');
@@ -194,7 +196,7 @@ class Adminer {
foreach ($links as $key => $val) { foreach ($links as $key => $val) {
echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>"; echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
} }
echo doc_link(array($jush => $driver->tableHelp($name)), "?"); echo doc_link(array($jush => $driver->tableHelp($name, $is_view)), "?");
echo "\n"; echo "\n";
} }

View File

@@ -188,9 +188,10 @@ function get_driver($id) {
/** Get help link for table /** Get help link for table
* @param string * @param string
* @param bool
* @return string relative URL or null * @return string relative URL or null
*/ */
function tableHelp($name) { function tableHelp($name, $is_view = false) {
} }
/** Check if C-style escapes are supported /** Check if C-style escapes are supported