From 8ef8838801e0df944f12bb95edf8d01e903aecf2 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 14 Oct 2021 20:19:39 +0200 Subject: [PATCH] Correct detection of row_number support for MariaDB (#57663) --- homeassistant/components/recorder/util.py | 4 +++- tests/components/recorder/test_util.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 567164d4325..8277f86e9f9 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -311,7 +311,9 @@ def setup_connection_for_dialect( result = query_on_connection(dbapi_connection, "SELECT VERSION()") version = result[0][0] major, minor, _patch = version.split(".", 2) - if int(major) == 5 and int(minor) < 8: + if (int(major) == 5 and int(minor) < 8) or ( + int(major) == 10 and int(minor) < 2 + ): instance._db_supports_row_number = ( # pylint: disable=[protected-access] False ) diff --git a/tests/components/recorder/test_util.py b/tests/components/recorder/test_util.py index 8b5de5cff16..ff690e24279 100644 --- a/tests/components/recorder/test_util.py +++ b/tests/components/recorder/test_util.py @@ -125,7 +125,8 @@ async def test_last_run_was_recently_clean(hass): @pytest.mark.parametrize( "mysql_version, db_supports_row_number", [ - ("10.0.0", True), + ("10.2.0", True), + ("10.1.0", False), ("5.8.0", True), ("5.7.0", False), ],