1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-11 09:04:02 +02:00

PostgreSQL: Skip editing generated columns

This commit is contained in:
Jakub Vrana
2025-03-06 18:44:18 +01:00
parent bd27ca0b2b
commit 6262b120f5
2 changed files with 3 additions and 1 deletions

View 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);

View 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