Handle timestamp PostgreSQL types (bug #3614086)
This commit is contained in:
parent
0869ff02c6
commit
e04be3a996
|
@ -227,6 +227,10 @@ AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema(
|
||||||
|
|
||||||
function fields($table) {
|
function fields($table) {
|
||||||
$return = array();
|
$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
|
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
|
FROM pg_class c
|
||||||
JOIN pg_namespace n ON c.relnamespace = n.oid
|
JOIN pg_namespace n ON c.relnamespace = n.oid
|
||||||
|
@ -239,8 +243,11 @@ AND a.attnum > 0
|
||||||
ORDER BY a.attnum"
|
ORDER BY a.attnum"
|
||||||
) as $row) {
|
) as $row) {
|
||||||
//! collation, primary
|
//! collation, primary
|
||||||
ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match);
|
$type = $row["full_type"];
|
||||||
list(, $row["type"], , $row["length"]) = $match;
|
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["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : "");
|
||||||
$row["null"] = !$row["attnotnull"];
|
$row["null"] = !$row["attnotnull"];
|
||||||
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]);
|
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]);
|
||||||
|
|
|
@ -789,7 +789,7 @@ function input($field, $value, $function) {
|
||||||
} else {
|
} else {
|
||||||
// int(3) is only a display hint
|
// 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));
|
$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
|
$maxlength += 7; // microtime
|
||||||
}
|
}
|
||||||
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
|
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
|
||||||
|
|
|
@ -4,6 +4,7 @@ Use shadow for highlighting default button
|
||||||
Don't use LIMIT 1 if inline updating unique row
|
Don't use LIMIT 1 if inline updating unique row
|
||||||
Order table list by name
|
Order table list by name
|
||||||
PostgreSQL: Fix detecting oid column in PDO
|
PostgreSQL: Fix detecting oid column in PDO
|
||||||
|
PostgreSQL: Handle timestamp types (bug #3614086)
|
||||||
|
|
||||||
Adminer 3.7.0 (released 2013-05-19):
|
Adminer 3.7.0 (released 2013-05-19):
|
||||||
Allow more SQL files to be uploaded at the same time
|
Allow more SQL files to be uploaded at the same time
|
||||||
|
|
Loading…
Reference in a new issue