mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 23:57:29 +02:00
PostgreSQL: Fix exporting string default values (thanks to PotatoPangolin)
This commit is contained in:
@@ -195,19 +195,26 @@ function process_type($field, $collate = "COLLATE") {
|
||||
* @return array array("field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT")
|
||||
*/
|
||||
function process_field($field, $type_field) {
|
||||
global $jush;
|
||||
$default = $field["default"];
|
||||
return array(
|
||||
idf_escape(trim($field["field"])),
|
||||
process_type($type_field),
|
||||
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
|
||||
(isset($default) ? " DEFAULT " . (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default) ? q($default) : $default) : ""),
|
||||
default_value($field),
|
||||
(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),
|
||||
);
|
||||
}
|
||||
|
||||
/** Get default value clause
|
||||
* @param array
|
||||
* @return string
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/** Get type class to use in CSS
|
||||
* @param string
|
||||
* @return string class=''
|
||||
|
Reference in New Issue
Block a user