Code

Ticket #14618: introspection.py.diff

File introspection.py.diff, 966 bytes (added by pyrou, 3 years ago)
Line 
1Index: introspection.py
2===================================================================
3--- introspection.py    (revision 14462)
4+++ introspection.py    (working copy)
5@@ -1,4 +1,5 @@
6 from django.db.backends import BaseDatabaseIntrospection
7+from django.db.utils import DatabaseError
8 from MySQLdb import ProgrammingError, OperationalError
9 from MySQLdb.constants import FIELD_TYPE
10 import re
11@@ -63,7 +64,7 @@
12                     AND referenced_table_name IS NOT NULL
13                     AND referenced_column_name IS NOT NULL""", [table_name])
14             constraints.extend(cursor.fetchall())
15-        except (ProgrammingError, OperationalError):
16+        except (ProgrammingError, OperationalError, DatabaseError):
17             # Fall back to "SHOW CREATE TABLE", for previous MySQL versions.
18             # Go through all constraints and save the equal matches.
19             cursor.execute("SHOW CREATE TABLE %s" % self.connection.ops.quote_name(table_name))