function fields($table) {
$return = array();
+ $aliases = array(
+ 'timestamp without time zone' => 'timestamp',
+ 'timestamp with time zone' => 'timestamptz',
+ );
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
FROM pg_class c
JOIN pg_namespace n ON c.relnamespace = n.oid
ORDER BY a.attnum"
) as $row) {
//! collation, primary
- ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match);
- list(, $row["type"], , $row["length"]) = $match;
+ $type = $row["full_type"];
+ if (ereg('(.+)\\((.*)\\)$', $row["full_type"], $match)) {
+ list(, $type, $row["length"]) = $match;
+ }
+ $row["type"] = ($aliases[$type] ? $aliases[$type] : $type);
$row["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : "");
$row["null"] = !$row["attnotnull"];
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]);
} else {
// int(3) is only a display hint
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
- if ($connection->server_info >= 5.6 && ereg('time', $field["type"])) {
+ if ($jush == 'sql' && $connection->server_info >= 5.6 && ereg('time', $field["type"])) {
$maxlength += 7; // microtime
}
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
Don't use LIMIT 1 if inline updating unique row
Order table list by name
PostgreSQL: Fix detecting oid column in PDO
+PostgreSQL: Handle timestamp types (bug #3614086)
Adminer 3.7.0 (released 2013-05-19):
Allow more SQL files to be uploaded at the same time