Ticket #14618: introspection.py.diff
File introspection.py.diff, 966 bytes (added by , 14 years ago) |
---|
-
introspection.py
1 1 from django.db.backends import BaseDatabaseIntrospection 2 from django.db.utils import DatabaseError 2 3 from MySQLdb import ProgrammingError, OperationalError 3 4 from MySQLdb.constants import FIELD_TYPE 4 5 import re … … 63 64 AND referenced_table_name IS NOT NULL 64 65 AND referenced_column_name IS NOT NULL""", [table_name]) 65 66 constraints.extend(cursor.fetchall()) 66 except (ProgrammingError, OperationalError ):67 except (ProgrammingError, OperationalError, DatabaseError): 67 68 # Fall back to "SHOW CREATE TABLE", for previous MySQL versions. 68 69 # Go through all constraints and save the equal matches. 69 70 cursor.execute("SHOW CREATE TABLE %s" % self.connection.ops.quote_name(table_name))