Also allow () in length and IN.
ORDER BY a.attnum"
) as $row) {
//! collation, primary
- $type = $row["full_type"];
- if (preg_match('~(.+)\\((.*)\\)$~', $row["full_type"], $match)) {
- list(, $type, $row["length"]) = $match;
- }
+ preg_match('~([^([]+)(\((.*)\))?((\[[0-9]*])*)$~', $row["full_type"], $match);
+ list(, $type, $length, $row["length"], $array) = $match;
+ $row["length"] .= $array;
$row["type"] = ($aliases[$type] ? $aliases[$type] : $type);
- $row["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : "");
+ $row["full_type"] = $row["type"] . $length . $array;
$row["null"] = !$row["attnotnull"];
$row["auto_increment"] = preg_match('~^nextval\\(~i', $row["default"]);
$row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);
$cond = " $val[op]";
if (preg_match('~IN$~', $val["op"])) {
$in = process_length($val["val"]);
- $cond .= " (" . ($in != "" ? $in : "NULL") . ")";
+ $cond .= " " . ($in != "" ? $in : "(NULL)");
} elseif ($val["op"] == "SQL") {
$cond = " $val[val]"; // SQL injection
} elseif ($val["op"] == "LIKE %%") {
*/
function process_length($length) {
global $enum_length;
- return (preg_match("~^\\s*$enum_length(?:\\s*,\\s*$enum_length)*+\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches) ? implode(",", $matches[0]) : preg_replace('~[^0-9,+-]~', '', $length));
+ return (preg_match("~^\\s*\\(?\\s*$enum_length(?:\\s*,\\s*$enum_length)*+\\s*\\)?\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches)
+ ? "(" . implode(",", $matches[0]) . ")"
+ : preg_replace('~[^-0-9,+()[\]]~', '', preg_replace('~^[0-9]+~', '(\1)', $length))
+ );
}
/** Create SQL string from field type
function process_type($field, $collate = "COLLATE") {
global $unsigned;
return " $field[type]"
- . ($field["length"] != "" ? "(" . process_length($field["length"]) . ")" : "")
+ . process_length($field["length"])
. (preg_match('~(^|[^o])int|float|double|decimal~', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " $collate " . q($field["collation"]) : "")
;
Don't display SQL edit form on Ctrl+click on the select query, introduced in Adminer 3.6.4
Use MD5 for editing long keys only in supported drivers, bug since Adminer 3.6.4
PostgreSQL: Fix handling of nextval() default values
+PostgreSQL: Support creating array columns
Adminer 3.7.1 (released 2013-06-29):
Increase click target for checkboxes
Backward keys in Editor
PostgreSQL:
-Array data types
Display number of schemas in databases overview
Users - SELECT * FROM pg_user
ORDER BY COUNT(*)