PostgreSQL: Adjusted detection of materialized views support

This commit is contained in:
Rossler Jan 2014-05-11 12:20:08 +02:00 committed by Jakub Vrana
parent 933f041f4d
commit 7a370e7885
3 changed files with 10 additions and 4 deletions

View file

@ -1001,7 +1001,7 @@ if (!defined("DRIVER")) {
} }
/** Check whether a feature is supported /** 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 * @return bool
*/ */
function support($feature) { function support($feature) {

View file

@ -225,12 +225,16 @@ if (isset($_GET["pgsql"])) {
} }
function tables_list() { 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 UNION ALL
SELECT matviewname, 'MATERIALIZED VIEW' SELECT matviewname, 'MATERIALIZED VIEW'
FROM pg_matviews FROM pg_matviews
WHERE schemaname = current_schema() WHERE schemaname = current_schema()
ORDER BY table_name"); ORDER BY table_name";
}
return get_key_vals($query);
} }
function count_tables($databases) { function count_tables($databases) {
@ -619,7 +623,8 @@ AND typelem = 0"
} }
function support($feature) { 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"; $jush = "pgsql";

View file

@ -6,6 +6,7 @@ Fix edit by long non-utf8 string
Specify encoding for PHP 5.6 with invalid default_charset Specify encoding for PHP 5.6 with invalid default_charset
Fix saving NULL value, bug since Adminer 4.0.3 Fix saving NULL value, bug since Adminer 4.0.3
MySQL: Use utf8mb4 if available MySQL: Use utf8mb4 if available
PostgreSQL: Materialized views
Elasticsearch: Use where in select Elasticsearch: Use where in select
Danish translation Danish translation