1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 23:57:29 +02:00

PostgreSQL: Added support for materialized views

This commit is contained in:
Rossler Jan
2014-05-10 03:57:35 +02:00
committed by Jakub Vrana
parent 51986426b7
commit abc8be3317
5 changed files with 44 additions and 22 deletions

View File

@@ -7,17 +7,27 @@ if ($_POST && !$error) {
$as = " AS\n$row[select]";
$location = ME . "table=" . urlencode($name);
$message = lang('View has been altered.');
if (!$_POST["drop"] && $TABLE == $name && $jush != "sqlite") {
if ($_GET["materialized"]) {
$type = "MATERIALIZED VIEW";
} else {
$type = "VIEW";
if ($jush == "pgsql") {
$status = table_status($name);
$type = ($status ? strtoupper($status["Engine"]) : $type);
}
}
if (!$_POST["drop"] && $TABLE == $name && $jush != "sqlite" && $type != "MATERIALIZED VIEW") {
query_redirect(($jush == "mssql" ? "ALTER" : "CREATE OR REPLACE") . " VIEW " . table($name) . $as, $location, $message);
} else {
$temp_name = $name . "_adminer_" . uniqid();
drop_create(
"DROP VIEW " . table($TABLE),
"CREATE VIEW " . table($name) . $as,
"DROP VIEW " . table($name),
"CREATE VIEW " . table($temp_name) . $as,
"DROP VIEW " . table($temp_name),
"DROP $type " . table($TABLE),
"CREATE $type " . table($name) . $as,
"DROP $type " . table($name),
"CREATE $type " . table($temp_name) . $as,
"DROP $type " . table($temp_name),
($_POST["drop"] ? substr(ME, 0, -1) : $location),
lang('View has been dropped.'),
$message,