1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 18:14:07 +02:00

PostgreSQL: Cast to string when searching using LIKE (bug #325)

This commit is contained in:
Jakub Vrana
2018-02-06 13:39:44 +01:00
parent 197abdcb70
commit d7f9b6b5de
5 changed files with 14 additions and 5 deletions

View File

@@ -277,7 +277,7 @@ if (!defined("DRIVER")) {
return queries($prefix . implode(",\n", $values) . $suffix);
}
function convertSearch($idf, $field) {
function convertSearch($idf, $val, $field) {
return (preg_match('~char|text|enum|set~', $field["type"]) && !preg_match("~^utf8~", $field["collation"])
? "CONVERT($idf USING " . charset($this->_conn) . ")"
: $idf

View File

@@ -181,6 +181,13 @@ if (isset($_GET["pgsql"])) {
return true;
}
function convertSearch($idf, $val, $field) {
return (preg_match('~char|text' . (is_numeric($val["val"]) && !preg_match('~LIKE~', $val["op"]) ? '|' . number_type() : '') . '~', $field["type"])
? $idf
: "CAST($idf AS text)"
);
}
function warnings() {
return $this->_conn->warnings();
}