]> git.joonet.de Git - adminer.git/commitdiff
- PostgreSQL: Avoid warning about crdb_version (fix #924, regression from 5.0.5)
authorJakub Vrana <jakub@vrana.cz>
Tue, 18 Mar 2025 15:20:44 +0000 (16:20 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 18 Mar 2025 15:20:44 +0000 (16:20 +0100)
CHANGELOG.md
adminer/drivers/pgsql.inc.php
adminer/include/functions.inc.php

index e1143665e4ea8d43c13e45270f9187e0922d14be..6527108c0960c05f6b0895b5dcb7a2a524e896e8 100644 (file)
@@ -1,6 +1,7 @@
 ## Adminer dev
 - PostgreSQL: Display auto_increment of inserted rows
 - PostgreSQL: Display description of system variables
+- PostgreSQL: Avoid warning about crdb_version (bug #924, regression from 5.0.5)
 - CSS: Sticky table headers (bug #918)
 - IMAP: New plugin driver created for fun
 
index 5fcaa091d3dcc1ac3b9d8c9a7219f168a0c0c0ba..eda220b833a7d0bc5533a38d63b906b00a54c7cd 100644 (file)
@@ -35,8 +35,6 @@ if (isset($_GET["pgsql"])) {
                                }
                                restore_error_handler();
                                if ($this->link) {
-                                       $version = pg_version($this->link);
-                                       $this->server_info = $version["server"];
                                        pg_set_client_encoding($this->link, "UTF8");
                                }
                                return (bool) $this->link;
@@ -334,8 +332,7 @@ if (isset($_GET["pgsql"])) {
                        if (min_version(9, 0, $connection)) {
                                $connection->query("SET application_name = 'Adminer'");
                        }
-                       $crdb_version = $connection->result("SHOW crdb_version");
-                       $connection->server_info .= ($crdb_version ? "-" . preg_replace('~ \(.*~', '', $crdb_version) : "");
+                       $connection->server_info = $connection->result("SELECT version()");
                        $connection->cockroach = preg_match('~CockroachDB~', $connection->server_info);
                        if ($connection->cockroach) { // we don't use "PostgreSQL / CockroachDB" by default because it's too long
                                $drivers[DRIVER] = "CockroachDB";
index 03ca625ba7fdb65e5dcbc299d253d75d7cdabe2c..94b72231d74cbcdf163fd773abfd43d1a1b2af74 100644 (file)
@@ -128,7 +128,7 @@ function min_version($version, $maria_db = "", $connection2 = null) {
                $server_info = $match[1];
                $version = $maria_db;
        }
-       return $version && version_compare($server_info, $version) >= 0;
+       return $version && version_compare(preg_replace('~^\D+~', '', $server_info), $version) >= 0;
 }
 
 /** Get connection charset