From 28c171f681bef0062861ab3b8810a468d15a33c1 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 7 Mar 2025 13:13:53 +0100 Subject: [PATCH] PostgreSQL: Support indexes on materialized views (PR #467) --- adminer/drivers/pgsql.inc.php | 4 ++++ adminer/include/driver.inc.php | 8 ++++++++ adminer/table.inc.php | 16 ++++++++-------- changes.txt | 1 + 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 4438e4a2..cafbbbd6 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -293,6 +293,10 @@ if (isset($_GET["pgsql"])) { } } + function supportsIndex($table_status) { + return $table_status["Engine"] != "view"; + } + function hasCStyleEscapes() { static $c_style; if ($c_style === null) { diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 2687a9d2..7e75edac 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -230,6 +230,14 @@ abstract class SqlDriver { return false; } + /** Check whether table supports indexes + * @param array result of table_status() + * @return bool + */ + function supportsIndex($table_status) { + return !is_view($table_status); + } + /** Get defined check constraints * @param string * @return array [$name => $clause] diff --git a/adminer/table.inc.php b/adminer/table.inc.php index b459816b..f3f388a1 100644 --- a/adminer/table.inc.php +++ b/adminer/table.inc.php @@ -26,16 +26,16 @@ if ($fields) { $adminer->tableStructurePrint($fields); } -if (!is_view($table_status)) { - if (support("indexes")) { - echo "

" . lang('Indexes') . "

\n"; - $indexes = indexes($TABLE); - if ($indexes) { - $adminer->tableIndexesPrint($indexes); - } - echo '

" . lang('Indexes') . "

\n"; + $indexes = indexes($TABLE); + if ($indexes) { + $adminer->tableIndexesPrint($indexes); } + echo '

" . lang('Foreign keys') . "

\n"; $foreign_keys = foreign_keys($TABLE); diff --git a/changes.txt b/changes.txt index 72c9f163..3fa11069 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,7 @@ Adminer dev: Fix bulk operations with tables Remove duplicate columns from select (bug #670) MariaDB: Fix link to status variable doc (bug #658) +PostgreSQL: Support indexes on materialized views (PR #467) Adminer 5.0.0 (released 2025-03-07): Speed up with disabled output buffering