diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 75a90681..81b6d13c 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -221,12 +221,17 @@ function process_type($field, $collate = "COLLATE") { * @return array array("field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT") */ function process_field($field, $type_field) { + // MariaDB exports CURRENT_TIMESTAMP as a function. + if ($field["on_update"]) { + $field["on_update"] = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $field["on_update"]); + } + return array( idf_escape(trim($field["field"])), process_type($type_field), ($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp default_value($field), - (preg_match('~timestamp|datetime~', $field["type"]) && $field["on_update"] ? " ON UPDATE $field[on_update]" : ""), + (preg_match('~timestamp|datetime~', $field["type"]) && $field["on_update"] ? " ON UPDATE " . $field["on_update"] : ""), (support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""), ($field["auto_increment"] ? auto_increment() : null), ); @@ -244,6 +249,9 @@ function default_value($field) { return " $default"; } + // MariaDB exports CURRENT_TIMESTAMP as a function. + $default = str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $default); + $quote = preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default); return " DEFAULT " . ($quote ? q($default) : $default);