PostgreSQL: Support for GENERATED BY DEFAULT AS IDENTITY
This commit is contained in:
parent
c002009bfe
commit
9f0ee9cf41
|
@ -349,7 +349,10 @@ WHERE relkind IN ('r', 'm', 'v', 'f')
|
|||
'timestamp without time zone' => 'timestamp',
|
||||
'timestamp with time zone' => 'timestamptz',
|
||||
);
|
||||
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
|
||||
|
||||
$identity_column = min_version(10) ? "(a.attidentity = 'd')::int" : '0';
|
||||
|
||||
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment, $identity_column AS identity
|
||||
FROM pg_class c
|
||||
JOIN pg_namespace n ON c.relnamespace = n.oid
|
||||
JOIN pg_attribute a ON c.oid = a.attrelid
|
||||
|
@ -372,8 +375,11 @@ ORDER BY a.attnum"
|
|||
$row["type"] = $type;
|
||||
$row["full_type"] = $row["type"] . $length . $addon . $array;
|
||||
}
|
||||
if ($row['identity']) {
|
||||
$row['default'] = 'GENERATED BY DEFAULT AS IDENTITY';
|
||||
}
|
||||
$row["null"] = !$row["attnotnull"];
|
||||
$row["auto_increment"] = preg_match('~^nextval\(~i', $row["default"]);
|
||||
$row["auto_increment"] = $row['identity'] || preg_match('~^nextval\(~i', $row["default"]);
|
||||
$row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);
|
||||
if (preg_match('~(.+)::[^)]+(.*)~', $row["default"], $match)) {
|
||||
$row["default"] = ($match[1] == "NULL" ? null : (($match[1][0] == "'" ? idf_unescape($match[1]) : $match[1]) . $match[2]));
|
||||
|
|
|
@ -12,6 +12,7 @@ MySQL: Support foreign keys created with ANSI quotes (bug #620)
|
|||
MySQL: Recognize ON UPDATE current_timestamp() (bug #632, bug #638)
|
||||
PostgreSQL: Quote array values in export (bug #621)
|
||||
PostgreSQL: Export DESC indexes (bug #639)
|
||||
PostgreSQL: Support GENERATED BY DEFAULT AS IDENTITY in PostgreSQL 10
|
||||
MSSQL: Pass database when connecting
|
||||
ClickHouse: Connect, databases list, tables list, select, SQL command
|
||||
Georgian translation
|
||||
|
|
Loading…
Reference in a new issue