From 3052952733050a13e501bccbc1b86e8428193002 Mon Sep 17 00:00:00 2001 From: Lubor Bilek Date: Thu, 10 Jul 2014 12:26:04 +0200 Subject: [PATCH] PostgreSQL: Fix timestamp(0) (fixes #383) --- adminer/drivers/pgsql.inc.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 6ede66cd..9b7a13a1 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -280,11 +280,17 @@ AND a.attnum > 0 ORDER BY a.attnum" ) as $row) { //! collation, primary - preg_match('~([^([]+)(\((.*)\))?((\[[0-9]*])*)$~', $row["full_type"], $match); - list(, $type, $length, $row["length"], $array) = $match; + preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~', $row["full_type"], $match); + list(, $type, $length, $row["length"], $addon, $array) = $match; $row["length"] .= $array; - $row["type"] = ($aliases[$type] ? $aliases[$type] : $type); - $row["full_type"] = $row["type"] . $length . $array; + $check_type = $type . $addon; + if (isset($aliases[$check_type])) { + $row["type"] = $aliases[$check_type]; + $row["full_type"] = $row["type"] . $length . $array; + } else { + $row["type"] = $type; + $row["full_type"] = $row["type"] . $length . $addon . $array; + } $row["null"] = !$row["attnotnull"]; $row["auto_increment"] = preg_match('~^nextval\\(~i', $row["default"]); $row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);