From 11c5c3b8012328dfc0fbb78c758335c6e6054cc5 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 2 Aug 2016 08:34:15 -0400 Subject: [PATCH] [1.10.x] Fixed #26991 -- Fixed a crash in MySQL where SELECT @@SQL_AUTO_IS_NULL doesn't return a result. Backport of 431cbd115b9aac22a539682820742d9966237a84 from master --- django/db/backends/mysql/features.py | 3 ++- docs/releases/1.10.1.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index ea5fd0d9e9..64ed8c2602 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -75,4 +75,5 @@ class DatabaseFeatures(BaseDatabaseFeatures): def is_sql_auto_is_null_enabled(self): with self.connection.cursor() as cursor: cursor.execute('SELECT @@SQL_AUTO_IS_NULL') - return cursor.fetchone()[0] == 1 + result = cursor.fetchone() + return result and result[0] == 1 diff --git a/docs/releases/1.10.1.txt b/docs/releases/1.10.1.txt index 1ebeb9c92a..2f4fd581b9 100644 --- a/docs/releases/1.10.1.txt +++ b/docs/releases/1.10.1.txt @@ -9,4 +9,5 @@ Django 1.10.1 fixes several bugs in 1.10. Bugfixes ======== -* ... +* Fixed a crash in MySQL connections where ``SELECT @@SQL_AUTO_IS_NULL`` + doesn't return a result (:ticket:`26991`).