1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 16:44:17 +02:00

PostgreSQL: Fix exporting CREATE TABLE query with GENERATED default values

Thanks to GottfriedCP (https://github.com/adminerevo/adminerevo/issues/157)
This commit is contained in:
Peter Knut
2024-09-17 17:01:17 +02:00
committed by Jakub Vrana
parent d8f1521b60
commit 1efb87fcbe

View File

@@ -238,7 +238,10 @@ function process_field($field, $type_field) {
*/ */
function default_value($field) { function default_value($field) {
$default = $field["default"]; $default = $field["default"];
return ($default === null ? "" : " DEFAULT " . (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default) ? q($default) : $default)); return ($default === null ? "" : " DEFAULT " .
(!preg_match('~^GENERATED ~i', $default) && (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default))
? q($default) : $default)
);
} }
/** Get type class to use in CSS /** Get type class to use in CSS