mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
[4.2.x] Fixed #34992 -- Fixed DatabaseFeatures.allows_group_by_selected_pks on MariaDB with ONLY_FULL_GROUP_BY sql mode.
Regression in041551d716. Backport of0257426fe1from main.
This commit is contained in:
committed by
Mariusz Felisiak
parent
bac9e94ace
commit
450d518d2f
@@ -42,3 +42,21 @@ class TestFeatures(TestCase):
|
||||
_connection.sql_mode = {"NO_AUTO_VALUE_ON_ZERO"}
|
||||
database_features = DatabaseFeatures(_connection)
|
||||
self.assertIs(database_features.allows_auto_pk_0, True)
|
||||
|
||||
def test_allows_group_by_selected_pks(self):
|
||||
with mock.MagicMock() as _connection:
|
||||
_connection.mysql_is_mariadb = False
|
||||
database_features = DatabaseFeatures(_connection)
|
||||
self.assertIs(database_features.allows_group_by_selected_pks, True)
|
||||
|
||||
with mock.MagicMock() as _connection:
|
||||
_connection.mysql_is_mariadb = False
|
||||
_connection.sql_mode = {}
|
||||
database_features = DatabaseFeatures(_connection)
|
||||
self.assertIs(database_features.allows_group_by_selected_pks, True)
|
||||
|
||||
with mock.MagicMock() as _connection:
|
||||
_connection.mysql_is_mariadb = True
|
||||
_connection.sql_mode = {"ONLY_FULL_GROUP_BY"}
|
||||
database_features = DatabaseFeatures(_connection)
|
||||
self.assertIs(database_features.allows_group_by_selected_pks, False)
|
||||
|
||||
Reference in New Issue
Block a user