Ticket #14618: introspection.py.diff

File introspection.py.diff, 966 bytes (added by pyrou, 5 years ago)
  • introspection.py

     
    11from django.db.backends import BaseDatabaseIntrospection
     2from django.db.utils import DatabaseError
    23from MySQLdb import ProgrammingError, OperationalError
    34from MySQLdb.constants import FIELD_TYPE
    45import re
     
    6364                    AND referenced_table_name IS NOT NULL
    6465                    AND referenced_column_name IS NOT NULL""", [table_name])
    6566            constraints.extend(cursor.fetchall())
    66         except (ProgrammingError, OperationalError):
     67        except (ProgrammingError, OperationalError, DatabaseError):
    6768            # Fall back to "SHOW CREATE TABLE", for previous MySQL versions.
    6869            # Go through all constraints and save the equal matches.
    6970            cursor.execute("SHOW CREATE TABLE %s" % self.connection.ops.quote_name(table_name))
Back to Top