Skip to content

[2.x] fix: normalize database version strings in admin dashboard#4466

Merged
imorland merged 1 commit into2.xfrom
im/clean-db-version-display
Mar 16, 2026
Merged

[2.x] fix: normalize database version strings in admin dashboard#4466
imorland merged 1 commit into2.xfrom
im/clean-db-version-display

Conversation

@imorland
Copy link
Member

Problem

The admin dashboard Status widget displays database versions inconsistently:

  • MariaDB version() returns 10.11.14-MariaDB-0+deb12u2 — the distribution suffix is noisy and redundant given the driver label already says "MariaDB"
  • PostgreSQL version() returns a full platform string like PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 12.2.0, 64-bit — far too verbose for a status widget
  • MySQL version() can include distro suffixes like 8.0.32-0ubuntu0.20.04.1
  • SQLite sqlite_version() already returns a clean 3.45.0 — no change needed

Fix

  • MySQL / MariaDB: strip everything from the first - onwards via Str::before()
  • PostgreSQL: switch from SELECT version() to SHOW server_version, which returns a clean version string (e.g. 15.3), consistent with what the installer already uses in ConnectToDatabase
  • SQLite: unchanged

Result

Driver Before After
MariaDB 10.11.14-MariaDB-0+deb12u2 10.11.14
PostgreSQL PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by... 15.3
MySQL 8.0.32-0ubuntu0.20.04.1 8.0.32
SQLite 3.45.0 3.45.0

MySQL/MariaDB's version() includes distribution suffixes like
"-MariaDB-0+deb12u2", and PostgreSQL's version() returns a full
platform description. Trim these to display clean version numbers.

- MySQL/MariaDB: strip everything after the first "-"
- PostgreSQL: use SHOW server_version instead of SELECT version(),
  which returns a clean semver string without platform info
- SQLite: unchanged (already returns a clean version)
@imorland imorland requested a review from a team as a code owner March 16, 2026 20:42
@imorland imorland added this to the 2.0.0-beta.8 milestone Mar 16, 2026
@imorland imorland merged commit 9fff5dc into 2.x Mar 16, 2026
27 checks passed
@imorland imorland deleted the im/clean-db-version-display branch March 16, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant