]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: Skip editing generated columns
authorJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 17:44:18 +0000 (18:44 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 6 Mar 2025 17:44:18 +0000 (18:44 +0100)
adminer/drivers/pgsql.inc.php
changes.txt

index 62274c1e055fc802b698f26253900d62448fb918..e25dbd58091a530da251c6787bbacdffaa96a53e 100644 (file)
@@ -415,7 +415,7 @@ WHERE relkind IN ('r', 'm', 'v', 'f', 'p')
                        'timestamp with time zone' => 'timestamptz',
                );
                foreach (
-                       get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ", a.attidentity" : "") . "
+                       get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, pg_get_expr(d.adbin, d.adrelid) AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment" . (min_version(10) ? ", a.attidentity" . (min_version(12) ? ", a.attgenerated" : "") : "") . "
 FROM pg_class c
 JOIN pg_namespace n ON c.relnamespace = n.oid
 JOIN pg_attribute a ON c.oid = a.attrelid
@@ -441,6 +441,7 @@ ORDER BY a.attnum") as $row
                        if (in_array($row['attidentity'], array('a', 'd'))) {
                                $row['default'] = 'GENERATED ' . ($row['attidentity'] == 'd' ? 'BY DEFAULT' : 'ALWAYS') . ' AS IDENTITY';
                        }
+                       $row["generated"] = ($row["attgenerated"] == "s");
                        $row["null"] = !$row["attnotnull"];
                        $row["auto_increment"] = $row['attidentity'] || preg_match('~^nextval\(~i', $row["default"]);
                        $row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);
index 344f92866dcd05dbd46c1f46fcbc7ef388365e87..5b7b01bf604aaed343170a224f93c63c9c5de001 100644 (file)
@@ -8,6 +8,7 @@ PostgreSQL: Display ENUM types
 PostgreSQL: Export ENUM types (bug #587)
 PostgreSQL: Display ? instead of -1 rows in table overview (bug #883)
 PostgreSQL: Show accessible databases to non-owners (regression from 4.9.1)
+PostgreSQL: Skip editing generated columns
 PostgreSQL, MS SQL, Oracle: Hide table actions for information_schema
 SQLite: Support CHECK constraint
 SQLite: Add command Check tables