mirror of
https://github.com/vrana/adminer.git
synced 2025-08-05 22:27:24 +02:00
PostgreSQL: Move partitioned tables from table list to parent table (bug #1031)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
## Adminer dev
|
||||
- PostgreSQL: Show partitioned tables as tables, not views
|
||||
- PostgreSQL: Move partitioned tables from table list to parent table
|
||||
- Designs: adminer.css with 'prefers-color-scheme: dark' don't disable dark mode
|
||||
- Plugins: Method bodyClass() to add <body class>
|
||||
|
||||
|
@@ -324,6 +324,16 @@ if (isset($_GET["pgsql"])) {
|
||||
}
|
||||
}
|
||||
|
||||
function inheritedTables(string $table): array {
|
||||
return get_vals("SELECT c.relname
|
||||
FROM pg_class p
|
||||
JOIN pg_namespace n ON n.nspname = current_schema() AND n.oid = p.relnamespace
|
||||
JOIN pg_inherits ON inhparent = p.oid
|
||||
JOIN pg_class c ON inhrelid = c.oid
|
||||
WHERE p.relname = " . q($table) . " AND p.relkind = 'p'
|
||||
ORDER BY 1");
|
||||
}
|
||||
|
||||
function supportsIndex(array $table_status): bool {
|
||||
// returns true for "materialized view"
|
||||
return $table_status["Engine"] != "view";
|
||||
@@ -415,9 +425,10 @@ ORDER BY 1";
|
||||
c.reltuples as \"Rows\",
|
||||
n.nspname
|
||||
FROM pg_class c
|
||||
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
||||
JOIN pg_namespace n ON n.nspname = current_schema() AND n.oid = c.relnamespace
|
||||
LEFT JOIN pg_inherits ON inhrelid = c.oid
|
||||
WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
|
||||
" . ($name != "" ? "AND relname = " . q($name) : "ORDER BY relname")) as $row //! Index_length, Auto_increment
|
||||
" . ($name != "" ? "AND relname = " . q($name) : "AND inhparent IS NULL ORDER BY relname")) as $row //! Auto_increment
|
||||
) {
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
|
@@ -217,6 +217,13 @@ abstract class SqlDriver {
|
||||
function tableHelp(string $name, bool $is_view = false) {
|
||||
}
|
||||
|
||||
/** Get inherited tables
|
||||
* @return list<string>
|
||||
*/
|
||||
function inheritedTables(string $table): array {
|
||||
return array();
|
||||
}
|
||||
|
||||
/** Check if C-style escapes are supported */
|
||||
function hasCStyleEscapes(): bool {
|
||||
return false;
|
||||
|
@@ -194,6 +194,7 @@ Lang::$translations = array(
|
||||
'Partitions' => 'Oddíly',
|
||||
'Partition name' => 'Název oddílu',
|
||||
'Values' => 'Hodnoty',
|
||||
'Inherited tables' => 'Zděděné tabulky',
|
||||
|
||||
'View' => 'Pohled',
|
||||
'Materialized view' => 'Materializovaný pohled',
|
||||
|
@@ -196,6 +196,7 @@ Lang::$translations = array(
|
||||
'Partitions' => 'Xx',
|
||||
'Partition name' => 'Xx',
|
||||
'Values' => 'Xx',
|
||||
'Inherited tables' => 'Xx',
|
||||
|
||||
'View' => 'Xx',
|
||||
'Materialized view' => 'Xx',
|
||||
|
@@ -95,3 +95,13 @@ if (support(is_view($table_status) ? "view_trigger" : "trigger")) {
|
||||
}
|
||||
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
|
||||
}
|
||||
|
||||
$inherited = driver()->inheritedTables($TABLE);
|
||||
if ($inherited) {
|
||||
echo "<h3 id='inherited'>" . lang('Inherited tables') . "</h3>\n";
|
||||
echo "<ul>\n";
|
||||
foreach ($inherited as $val) {
|
||||
echo "<li><a href='" . h(ME . "table=" . urlencode($val)) . "'>" . h($val) . "</a>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user