1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-17 03:53:59 +02:00

PostgreSQL: Don't treat interval type as number (bug #474)

This commit is contained in:
Jakub Vrana
2018-02-06 12:17:01 +01:00
parent 11a7fc0277
commit 6cfb3676a7
8 changed files with 20 additions and 10 deletions

View File

@@ -543,7 +543,7 @@ class Adminer {
$cols = array();
foreach ($fields as $name => $field) {
$is_text = preg_match('~char|text|enum|set~', $field["type"]);
if ((is_numeric($val["val"]) || !preg_match('~(^|[^o])int|float|double|decimal|bit~', $field["type"]))
if ((is_numeric($val["val"]) || !preg_match('~' . number_type() . '|bit~', $field["type"]))
&& (!preg_match("~[\x80-\xFF]~", $val["val"]) || $is_text)
) {
$name = idf_escape($name);
@@ -828,7 +828,7 @@ class Adminer {
foreach ($row as $key => $val) {
$field = $fields[$key];
$row[$key] = ($val !== null
? unconvert_field($field, preg_match('~(^|[^o])int|float|double|decimal~', $field["type"]) && $val != '' ? $val : q($val))
? unconvert_field($field, preg_match('~' . number_type() . '~', $field["type"]) && $val != '' ? $val : q($val))
: "NULL"
);
}