mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 16:17:48 +02:00
Fix PgSQL generated always as identity fix
This commit is contained in:
@@ -350,7 +350,7 @@ WHERE relkind IN ('r', 'm', 'v', 'f')
|
|||||||
'timestamp with time zone' => 'timestamptz',
|
'timestamp with time zone' => 'timestamptz',
|
||||||
);
|
);
|
||||||
|
|
||||||
$identity_column = min_version(10) ? "(a.attidentity = 'd')::int" : '0';
|
$identity_column = min_version(10) ? 'a.attidentity' : '0';
|
||||||
|
|
||||||
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, $identity_column AS identity
|
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, $identity_column AS identity
|
||||||
FROM pg_class c
|
FROM pg_class c
|
||||||
@@ -375,8 +375,8 @@ ORDER BY a.attnum"
|
|||||||
$row["type"] = $type;
|
$row["type"] = $type;
|
||||||
$row["full_type"] = $row["type"] . $length . $addon . $array;
|
$row["full_type"] = $row["type"] . $length . $addon . $array;
|
||||||
}
|
}
|
||||||
if ($row['identity']) {
|
if (in_array($row['identity'], array('a', 'd'))) {
|
||||||
$row['default'] = 'GENERATED BY DEFAULT AS IDENTITY';
|
$row['default'] = 'GENERATED ' . ($row['identity'] == 'd' ? 'BY DEFAULT' : 'ALWAYS') . ' AS IDENTITY';
|
||||||
}
|
}
|
||||||
$row["null"] = !$row["attnotnull"];
|
$row["null"] = !$row["attnotnull"];
|
||||||
$row["auto_increment"] = $row['identity'] || preg_match('~^nextval\(~i', $row["default"]);
|
$row["auto_increment"] = $row['identity'] || preg_match('~^nextval\(~i', $row["default"]);
|
||||||
|
@@ -2,6 +2,7 @@ Adminer 4.7.9-dev:
|
|||||||
Elasticsearch, ClickHouse: Do not print response if HTTP code is not 200
|
Elasticsearch, ClickHouse: Do not print response if HTTP code is not 200
|
||||||
PostgreSQL: Export all FKs after all CREATE TABLE (PR #351)
|
PostgreSQL: Export all FKs after all CREATE TABLE (PR #351)
|
||||||
PostgreSQL: Fix dollar-quoted syntax highlighting (bug #738)
|
PostgreSQL: Fix dollar-quoted syntax highlighting (bug #738)
|
||||||
|
PostgreSQL 10: Support GENERATED ALWAYS BY IDENTITY (PR #386)
|
||||||
Re-enable PHP warnings (regression from 4.7.8)
|
Re-enable PHP warnings (regression from 4.7.8)
|
||||||
|
|
||||||
Adminer 4.7.8 (released 2020-12-06):
|
Adminer 4.7.8 (released 2020-12-06):
|
||||||
|
Reference in New Issue
Block a user