]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: Adjusted detection of materialized views support
authorRossler Jan <janrossler@email.cz>
Sun, 11 May 2014 10:20:08 +0000 (12:20 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sat, 13 Sep 2014 18:19:38 +0000 (11:19 -0700)
adminer/drivers/mysql.inc.php
adminer/drivers/pgsql.inc.php
changes.txt

index 021db8a71ca36554eaba14a4e8e9399bb8c8c281..341c32a698ac448a342a183b6ea688f285fab298 100644 (file)
@@ -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) {
index b18303157a7b411bf41e08e0fdf642b51392d522..6ede66cdc1df30aee0a11f40aa3a7cc58796bee6 100644 (file)
@@ -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";
index ea8d92a807f8343db0141dbb01f71cd996d76e9f..b60b67ca5fecf25357b035f6465f50eb966501c2 100644 (file)
@@ -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