'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
$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]));
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