From 1efb87fcbefe572a8c663437f7fec3d96e330f49 Mon Sep 17 00:00:00 2001 From: Peter Knut Date: Tue, 17 Sep 2024 17:01:17 +0200 Subject: [PATCH] PostgreSQL: Fix exporting CREATE TABLE query with GENERATED default values Thanks to GottfriedCP (https://github.com/adminerevo/adminerevo/issues/157) --- adminer/include/editing.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 6bd0ade1..0f29742d 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -238,7 +238,10 @@ function process_field($field, $type_field) { */ function default_value($field) { $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