1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

- PostgreSQL: Avoid warning about crdb_version (fix #924, regression from 5.0.5)

This commit is contained in:
Jakub Vrana
2025-03-18 16:20:44 +01:00
parent 3fb6cac361
commit 751405e006
3 changed files with 3 additions and 5 deletions

View 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

View 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";

View 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