Skip to content

Commit d95c669

Browse files
authored
Fixed #26991 -- Fixed a crash in MySQL where SQL_AUTO_IS_NULL doesn't return a result.
1 parent 013ee21 commit d95c669

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

django/db/backends/mysql/features.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ def introspected_boolean_field_type(self, *args, **kwargs):
7575
def is_sql_auto_is_null_enabled(self):
7676
with self.connection.cursor() as cursor:
7777
cursor.execute('SELECT @@SQL_AUTO_IS_NULL')
78-
return cursor.fetchone()[0] == 1
78+
result = cursor.fetchone()
79+
return result and result[0] == 1

docs/releases/1.10.1.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ Django 1.10.1 fixes several bugs in 1.10.
99
Bugfixes
1010
========
1111

12-
* ...
12+
* Fixed a crash in MySQL connections where ``SELECT @@SQL_AUTO_IS_NULL``
13+
doesn't return a result (:ticket:`26991`).

0 commit comments

Comments
 (0)