﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13028	Introspection doesn't work on mysql 4.1	pczapla	nobody	"When I ran introspection against mysql 4.1, I've got the following error:

{{{
 python manage.py  inspectdb
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#     * Rearrange models' order
#     * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.

from django.db import models

class Wrk(models.Model):
Traceback (most recent call last):
  File ""manage.py"", line 15, in <module>
    execute_manager(settings)
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/__init__.py"", line 438, in execute_manager
    utility.execute()
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/__init__.py"", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/base.py"", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/base.py"", line 222, in execute
    output = self.handle(*args, **options)
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/base.py"", line 351, in handle
    return self.handle_noargs(**options)
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/commands/inspectdb.py"", line 22, in handle_noargs
    for line in self.handle_inspection(options):
  File ""/home/pczapla/test/libsdjango-trunk/django/core/management/commands/inspectdb.py"", line 47, in handle_inspection
    relations = connection.introspection.get_relations(cursor, table_name)
  File ""/home/pczapla/test/libsdjango-trunk/django/db/backends/mysql/introspection.py"", line 64, in get_relations
    AND referenced_column_name IS NOT NULL"""""", [table_name])
  File ""/home/pczapla/test/libsdjango-trunk/django/db/backends/util.py"", line 19, in execute
    return self.cursor.execute(sql, params)
  File ""/home/pczapla/test/libsdjango-trunk/django/db/backends/mysql/base.py"", line 86, in execute
    return self.cursor.execute(query, args)
  File ""/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py"", line 173, in execute
    self.errorhandler(self, exc, value)
  File ""/usr/lib64/python2.6/site-packages/MySQLdb/connections.py"", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, ""Table 'information_schema.key_column_usage' doesn't exist"")
}}}

To fix this problem I've added the DatabaseError to the ""except"" statement in get_relations table.
The patch is attached."		closed	Database layer (models, ORM)	dev		wontfix			Unreviewed	1	0	0	0	0	0
