From 116827060fbad22951f553a31c9a0e540479b199 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 3 Mar 2025 15:50:08 +0100 Subject: [PATCH] PostgreSQL, MS SQL, Oracle: Hide table actions for information_schema --- adminer/drivers/mssql.inc.php | 2 +- adminer/drivers/oracle.inc.php | 2 +- adminer/drivers/pgsql.inc.php | 2 +- adminer/foreign.inc.php | 5 ++++- changes.txt | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php index 52b3dd15..1d5dbcde 100644 --- a/adminer/drivers/mssql.inc.php +++ b/adminer/drivers/mssql.inc.php @@ -392,7 +392,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table) } function information_schema($db) { - return false; + return get_schema() == "INFORMATION_SCHEMA"; } function error() { diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index 65cb4894..f25c551c 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -346,7 +346,7 @@ ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row) { } function information_schema($db) { - return false; + return get_schema() == "INFORMATION_SCHEMA"; } function error() { diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 7328a603..0d05854e 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -471,7 +471,7 @@ ORDER BY conkey, conname") as $row) { } function information_schema($db) { - return ($db == "information_schema"); + return get_schema() == "information_schema"; } function error() { diff --git a/adminer/foreign.inc.php b/adminer/foreign.inc.php index 99caf5cb..7da2d551 100644 --- a/adminer/foreign.inc.php +++ b/adminer/foreign.inc.php @@ -64,7 +64,10 @@ $target = array_keys(fields(in_array($row["table"], $referencable) ? $row["table $onchange = "this.form['change-js'].value = '1'; this.form.submit();"; echo "

" . lang('Target table') . ": " . html_select("table", $referencable, $row["table"], $onchange) . "\n"; if (support("scheme")) { - echo lang('Schema') . ": " . html_select("ns", $adminer->schemas(), $row["ns"] != "" ? $row["ns"] : $_GET["ns"], $onchange); + $schemas = array_filter($adminer->schemas(), function ($schema) { + return !preg_match('~^information_schema$~i', $schema); + }); + echo lang('Schema') . ": " . html_select("ns", $schemas, $row["ns"] != "" ? $row["ns"] : $_GET["ns"], $onchange); if ($row["ns"] != "") { set_schema($orig_schema); } diff --git a/changes.txt b/changes.txt index e3c66f57..0f693f8d 100644 --- a/changes.txt +++ b/changes.txt @@ -6,6 +6,7 @@ PostgreSQL: Fix export of indexes with expressions (bug #768) PostgreSQL: Display ENUM types PostgreSQL: Export ENUM types (bug #587) PostgreSQL: Show accessible databases to non-owners (regression from 4.9.1) +PostgreSQL, MS SQL, Oracle: Hide table actions for information_schema SQLite: Support CHECK constraint SQLite: Add command Check tables SQLite: Display all rows of variable values