]> git.joonet.de Git - adminer.git/commitdiff
PostreSQL: Fix search condition for network address types, add macaddr8 type
authorPeter Knut <peter@pematon.com>
Tue, 10 Sep 2024 08:27:59 +0000 (10:27 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Feb 2025 10:16:38 +0000 (11:16 +0100)
This fixes issue https://github.com/adminerevo/adminerevo/issues/115

adminer/drivers/pgsql.inc.php

index eafce8f8a7397e4686463914579b3bbe3fb5b26e..427c3df12a3bc6a97772ecdd34af41e74f46a508 100644 (file)
@@ -213,12 +213,12 @@ if (isset($_GET["pgsql"])) {
                }
 
                function convertSearch($idf, $val, $field) {
-                       return (preg_match('~char|text'
-                                       . (!preg_match('~LIKE~', $val["op"]) ? '|date|time(stamp)?|boolean|uuid|' . number_type() : '')
-                                       . '~', $field["type"])
-                               ? $idf
-                               : "CAST($idf AS text)"
-                       );
+                       $textTypes = "char|text";
+                       if (strpos($val["op"], "LIKE") === false) {
+                               $textTypes .= "|date|time(stamp)?|boolean|uuid|inet|cidr|macaddr|" . number_type();
+                       }
+
+                       return (preg_match("~$textTypes~", $field["type"]) ? $idf : "CAST($idf AS text)");
                }
 
                function quoteBinary($s) {
@@ -899,7 +899,7 @@ AND typelem = 0"
                        lang('Date and time') => array("date" => 13, "time" => 17, "timestamp" => 20, "timestamptz" => 21, "interval" => 0),
                        lang('Strings') => array("character" => 0, "character varying" => 0, "text" => 0, "tsquery" => 0, "tsvector" => 0, "uuid" => 0, "xml" => 0),
                        lang('Binary') => array("bit" => 0, "bit varying" => 0, "bytea" => 0),
-                       lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "txid_snapshot" => 0),
+                       lang('Network') => array("cidr" => 43, "inet" => 43, "macaddr" => 17, "macaddr8" => 23, "txid_snapshot" => 0),
                        lang('Geometry') => array("box" => 0, "circle" => 0, "line" => 0, "lseg" => 0, "path" => 0, "point" => 0, "polygon" => 0),
                ) as $key => $val) { //! can be retrieved from pg_type
                        $types += $val;