]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL: Do not cast number searches to text
authorJakub Vrana <jakub@vrana.cz>
Tue, 13 Mar 2018 13:09:53 +0000 (14:09 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 13 Mar 2018 13:09:53 +0000 (14:09 +0100)
adminer/drivers/pgsql.inc.php
adminer/include/adminer.inc.php
changes.txt

index 01e2cb519f02ff4fc8f791d45a52077b2de6c1f8..6953ebf63fa243436040b0e0ecaa2d6c34375b16 100644 (file)
@@ -216,7 +216,7 @@ if (isset($_GET["pgsql"])) {
 
                function convertSearch($idf, $val, $field) {
                        return (preg_match('~char|text'
-                                       . (!preg_match('~LIKE~', $val["op"]) ? '|date|time(stamp)?' . (is_numeric($val["val"]) ? '|' . number_type() : '') : '')
+                                       . (!preg_match('~LIKE~', $val["op"]) ? '|date|time(stamp)?|' . number_type() : '')
                                        . '~', $field["type"])
                                ? $idf
                                : "CAST($idf AS text)"
index c0fa596858ba8d4f9c281fd04b0fe0d329447fe3..4d2f5b3ae6897c1089cb4c0568dcf3613d0d7286 100644 (file)
@@ -560,7 +560,7 @@ class Adminer {
                                        // find anywhere
                                        $cols = array();
                                        foreach ($fields as $name => $field) {
-                                               if ((is_numeric($val["val"]) || !preg_match('~' . number_type() . '|bit~', $field["type"]))
+                                               if ((preg_match('~^[-\d.' . (preg_match('~IN$~', $val["op"]) ? ',' : '') . ']+$~', $val["val"]) || !preg_match('~' . number_type() . '|bit~', $field["type"]))
                                                        && (!preg_match("~[\x80-\xFF]~", $val["val"]) || preg_match('~char|text|enum|set~', $field["type"]))
                                                ) {
                                                        $cols[] = $prefix . $driver->convertSearch(idf_escape($name), $val, $field) . $cond;
index 3416bff40f77bb8035b4610ec9eb2f3d917e1857..443767fa33160b00ac2c49c328619ca7205430f0 100644 (file)
@@ -5,9 +5,9 @@ Decrease timeout for running slow queries from 5 seconds to 2 seconds
 Fix displaying info about non-alphabetical objects (bug #599)
 PDO: Support binary fields download
 MySQL: Use CONVERT() only when searching for non-ASCII (bug #603)
-PostgreSQL: Fix editing data in views (bug #605, regression from 4.6.0)
-PostgreSQL: Do not cast date/time searches to text
 PostgreSQL: Add SQL operator to search
+PostgreSQL: Fix editing data in views (bug #605, regression from 4.6.0)
+PostgreSQL: Do not cast date/time/number searches to text
 
 Adminer 4.6.2 (released 2018-02-20):
 Semi-transparent border on table actions