Skip to content

Commit 966a54a

Browse files
committed
fix: display version for Homebrew MySQL
1 parent eea4df4 commit 966a54a

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Bug Fixes
55
---------
66
* Keep completion-menu Escape cancellation eager only in Vi mode so Emacs Alt-key bindings keep working while completions are open.
77
* Keep identifiers that start with `set` highlighted as names.
8+
* Fix version display for MySQL distributions that return a plain `X.Y.Z` version string with no suffix (e.g. Homebrew MySQL).
89

910

1011
Internal

mycli/sqlexecute.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def from_version_string(cls, version_string: str) -> ServerInfo:
6868
(r"(?P<version>[0-9\.]+)-MariaDB", ServerSpecies.MariaDB),
6969
(r"[0-9\.]*-TiDB-v(?P<version>[0-9\.]+)-?(?P<comment>[a-z0-9\-]*)", ServerSpecies.TiDB),
7070
(r"(?P<version>[0-9\.]+)[a-z0-9]*-(?P<comment>[0-9]+$)", ServerSpecies.Percona),
71-
(r"(?P<version>[0-9\.]+)[a-z0-9]*-(?P<comment>[A-Za-z0-9_]+)", ServerSpecies.MySQL),
71+
# Also matches plain "X.Y.Z" with no suffix (e.g. Homebrew MySQL).
72+
(r"(?P<version>[0-9]+\.[0-9]+\.[0-9]+)[a-z0-9]*(-(?P<comment>[A-Za-z0-9_]+))?", ServerSpecies.MySQL),
7273
)
7374
for regexp, species in re_species:
7475
match = re.search(regexp, version_string)

test/pytests/test_sqlexecute.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ def test_multiple_results(executor):
429429
("5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal", "MariaDB", "10.5.8", 100508),
430430
("5.0.16-pro-nt-log", "MySQL", "5.0.16", 50016),
431431
("5.1.5a-alpha", "MySQL", "5.1.5", 50105),
432+
# Plain X.Y.Z with no suffix (e.g. Homebrew MySQL)
433+
("5.7.99", "MySQL", "5.7.99", 50799),
432434
("unexpected version string", None, "", 0),
433435
("", None, "", 0),
434436
(None, None, "", 0),

0 commit comments

Comments
 (0)