mirror of
https://github.com/vrana/adminer.git
synced 2025-08-21 05:41:27 +02:00
PostgreSQL: Do not cast number searches to text
This commit is contained in:
@@ -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)"
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user