From 2b64ff68cc375b5688174b4087bf44be9edd2558 Mon Sep 17 00:00:00 2001 From: Markus Gerards Date: Wed, 7 Sep 2016 13:43:51 +0200 Subject: [PATCH] Fixed #27180 -- Fixed a crash in MySQL checks where SELECT @@sql_mode doesn't return a result. --- django/db/backends/mysql/validation.py | 2 +- docs/releases/1.10.2.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/django/db/backends/mysql/validation.py b/django/db/backends/mysql/validation.py index e62a6e4c7e4..5a50663dd23 100644 --- a/django/db/backends/mysql/validation.py +++ b/django/db/backends/mysql/validation.py @@ -13,7 +13,7 @@ class DatabaseValidation(BaseDatabaseValidation): with self.connection.cursor() as cursor: cursor.execute("SELECT @@sql_mode") sql_mode = cursor.fetchone() - modes = set(sql_mode[0].split(',')) + modes = set(sql_mode[0].split(',') if sql_mode else ()) if not (modes & {'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES'}): return [checks.Warning( "MySQL Strict Mode is not set for database connection '%s'" % self.connection.alias, diff --git a/docs/releases/1.10.2.txt b/docs/releases/1.10.2.txt index 4154836a1d3..f3c574d7d1c 100644 --- a/docs/releases/1.10.2.txt +++ b/docs/releases/1.10.2.txt @@ -9,4 +9,5 @@ Django 1.10.2 fixes several bugs in 1.10.1. Bugfixes ======== -* ... +* Fixed a crash in MySQL database validation where ``SELECT @@sql_mode`` + doesn't return a result (:ticket:`27180`).