]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: Hide only partitions, not all inherited tables from menu
authorJakub Vrana <jakub@vrana.cz>
Tue, 3 Jun 2025 13:05:12 +0000 (15:05 +0200)
committerJakub Vrana <jakub@vrana.cz>
Tue, 3 Jun 2025 13:05:12 +0000 (15:05 +0200)
CHANGELOG.md
adminer/drivers/pgsql.inc.php
adminer/include/adminer.inc.php
phpstan.neon
plugins/menu-links.php

index 1ffdf9c4de49a7b3a2ccf4fcc5b033dc3d028822..83cf4869940b29b7ee24db4028a9c7fb2855d845 100644 (file)
@@ -2,6 +2,7 @@
 - Allow specifying operator in search anywhere
 - MySQL 5.0-: Do not load partitioning info in alter table (bug #1099)
 - PostgreSQL: Show structure of inherited tables
+- PostgreSQL: Hide only partitions, not all inherited tables from menu
 - PostgreSQL 11-: Avoid duplicate oid in table status (bug #1089)
 - Plugins: Methods processList() and killProcess()
 
index 9d4e72235b3c49ce27d6851eda4792ec13bc14ef..65f29a7f263dbb9efbeb8871f952103a96d426df 100644 (file)
@@ -340,7 +340,7 @@ if (isset($_GET["pgsql"])) {
                }
 
                function partitionsInfo(string $table): array {
-                       $row = connection()->query("SELECT * FROM pg_partitioned_table WHERE partrelid = " . driver()->tableOid($table))->fetch_assoc();
+                       $row = connection()->query("SELECT * FROM pg_partitioned_table WHERE partrelid = " . $this->tableOid($table))->fetch_assoc();
                        if ($row) {
                                $attrs = get_vals("SELECT attname FROM pg_attribute WHERE attrelid = $row[partrelid] AND attnum IN (" . str_replace(" ", ", ", $row["partattrs"]) . ")"); //! ordering
                                $by = array('h' => 'HASH', 'l' => 'LIST', 'r' => 'RANGE');
@@ -453,7 +453,7 @@ ORDER BY 1";
        obj_description(oid, 'pg_class') AS \"Comment\",
        " . (min_version(12) ? "''" : "CASE WHEN relhasoids THEN 'oid' ELSE '' END") . " AS \"Oid\",
        reltuples AS \"Rows\",
-       (SELECT inhparent FROM pg_inherits WHERE inhrelid = oid) AS inherited,
+       " . (min_version(10) ? "relispartition::int AS partition," : "") . "
        current_schema() AS nspname
 FROM pg_class
 WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
index f68c15e00ebc60767b25136b1a3e4d6325fa8739..69fd67f2cf9891cae01982c18336117bfe117890 100644 (file)
@@ -1100,7 +1100,7 @@ class Adminer {
                foreach ($tables as $table => $status) {
                        $table = "$table"; // do not highlight "0" as active everywhere
                        $name = adminer()->tableName($status);
-                       if ($name != "" && !$status["inherited"]) {
+                       if ($name != "" && !$status["partition"]) {
                                echo '<li><a href="' . h(ME) . 'select=' . urlencode($table) . '"'
                                        . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select")
                                        . " title='" . lang('Select data') . "'>" . lang('select') . "</a> "
index 7fac67faf15bea73785fad64556936c672ab87d2..516bc5b25bc3da46fbf86b71e4088a8a55056ef2 100644 (file)
@@ -61,7 +61,7 @@ parameters:
                max: 80499
 
        typeAliases:
-               TableStatus: "array{Name:string, Engine?:?string, Comment?:string, Oid?:numeric-string, Rows?:?numeric-string, Collation?:string, Auto_increment?:?numeric-string, Data_length?:numeric-string, Index_length?:numeric-string, Data_free?:numeric-string, Create_options?:string, inherited?:numeric-string, nspname?:string}"
+               TableStatus: "array{Name:string, Engine?:?string, Comment?:string, Oid?:numeric-string, Rows?:?numeric-string, Collation?:string, Auto_increment?:?numeric-string, Data_length?:numeric-string, Index_length?:numeric-string, Data_free?:numeric-string, Create_options?:string, partition?:numeric-string, nspname?:string}"
                Field: "array{field?:string, full_type:string, type:string, length:numeric-string, unsigned:string, default?:string, null:bool, auto_increment:bool, collation:string, privileges:int[], comment:string, primary:bool, generated:string, orig?:string, on_update?:string, on_delete?:string, default_constraint?: string}"
                FieldType: "array{type:string, length:numeric-string, unsigned:string, collation:string}" # subset of RoutineField and Field
                RoutineField: "array{field:string, type:string, length:numeric-string, unsigned:string, null:bool, full_type:string, collation:string, inout?:string}"
index 544f2cfed1f166a88baeb54c35c5057be3e409a8..d3dc96e7758cbd10dd9b59760849f2790cc160cb 100644 (file)
@@ -36,7 +36,7 @@ class AdminerMenuLinks extends Adminer\Plugin {
                foreach ($tables as $table => $status) {
                        $table = "$table"; // do not highlight "0" as active everywhere
                        $name = Adminer\adminer()->tableName($status);
-                       if ($name != "" && !$status["inherited"]) {
+                       if ($name != "" && !$status["partition"]) {
                                echo '<li>';
                                if (!$menu) {
                                        echo '<a href="' . Adminer\h(Adminer\ME) . 'select=' . urlencode($table) . '"'