From 7a370e78853d117e3750a9f09387d851971cba3f Mon Sep 17 00:00:00 2001 From: Rossler Jan Date: Sun, 11 May 2014 12:20:08 +0200 Subject: [PATCH] PostgreSQL: Adjusted detection of materialized views support --- adminer/drivers/mysql.inc.php | 2 +- adminer/drivers/pgsql.inc.php | 11 ++++++++--- changes.txt | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 021db8a7..341c32a6 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -1001,7 +1001,7 @@ if (!defined("DRIVER")) { } /** Check whether a feature is supported - * @param string "comment", "copy", "database", "drop_col", "dump", "event", "kill", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger" + * @param string "comment", "copy", "database", "drop_col", "dump", "event", "kill", "materializedview", "partitioning", "privileges", "procedure", "processlist", "routine", "scheme", "sequence", "status", "table", "trigger", "type", "variables", "view", "view_trigger" * @return bool */ function support($feature) { diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index b1830315..6ede66cd 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -225,12 +225,16 @@ if (isset($_GET["pgsql"])) { } function tables_list() { - return get_key_vals("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() + $query = "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()"; + if (support('materializedview')) { + $query .= " UNION ALL SELECT matviewname, 'MATERIALIZED VIEW' FROM pg_matviews WHERE schemaname = current_schema() -ORDER BY table_name"); +ORDER BY table_name"; + } + return get_key_vals($query); } function count_tables($databases) { @@ -619,7 +623,8 @@ AND typelem = 0" } function support($feature) { - return preg_match('~^(database|table|columns|sql|indexes|comment|view|materializedview|scheme|processlist|sequence|trigger|type|variables|drop_col)$~', $feature); //! routine| + global $connection; + return preg_match('~^(database|table|columns|sql|indexes|comment|view|' . ($connection->server_info >= 9.3 ? 'materializedview|' : '') . 'scheme|processlist|sequence|trigger|type|variables|drop_col)$~', $feature); //! routine| } $jush = "pgsql"; diff --git a/changes.txt b/changes.txt index ea8d92a8..b60b67ca 100644 --- a/changes.txt +++ b/changes.txt @@ -6,6 +6,7 @@ Fix edit by long non-utf8 string Specify encoding for PHP 5.6 with invalid default_charset Fix saving NULL value, bug since Adminer 4.0.3 MySQL: Use utf8mb4 if available +PostgreSQL: Materialized views Elasticsearch: Use where in select Danish translation