Skip to content

Commit

Permalink
PostgreSQL: Adjusted detection of materialized views support
Browse files Browse the repository at this point in the history
  • Loading branch information
JanRossler authored and vrana committed Sep 13, 2014
1 parent 933f041 commit 7a370e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion adminer/drivers/mysql.inc.php
Expand Up @@ -1001,7 +1001,7 @@ function unconvert_field($field, $return) {
}

/** 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) {
Expand Down
11 changes: 8 additions & 3 deletions adminer/drivers/pgsql.inc.php
Expand Up @@ -225,12 +225,16 @@ function logged_user() {
}

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) {
Expand Down Expand Up @@ -619,7 +623,8 @@ function unconvert_field($field, $return) {
}

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";
Expand Down
1 change: 1 addition & 0 deletions changes.txt
Expand Up @@ -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

Expand Down

0 comments on commit 7a370e7

Please sign in to comment.