From ecf6a3511228eb901b8d69243fc6d6d6d9e89f6b Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 11 Sep 2006 18:41:05 +0000 Subject: [PATCH] Fixed #2700 -- Improved introspection for MySQL. Thanks for the patch, serbaut@gmail.com git-svn-id: http://code.djangoproject.com/svn/django/trunk@3750 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/db/backends/mysql/introspection.py | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 20251599da..bad8008d86 100644 --- a/AUTHORS +++ b/AUTHORS @@ -127,6 +127,7 @@ answer newbie questions, and generally made Django that much better: Oliver Rutherfurd Ivan Sagalaev (Maniac) David Schein + serbaut@gmail.com Pete Shinners SmileyChris sopel diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py index e227f72706..7829457fa9 100644 --- a/django/db/backends/mysql/introspection.py +++ b/django/db/backends/mysql/introspection.py @@ -36,6 +36,7 @@ def get_relations(cursor, table_name): SELECT column_name, referenced_table_name, referenced_column_name FROM information_schema.key_column_usage WHERE table_name = %s + AND table_schema = DATABASE() AND referenced_table_name IS NOT NULL AND referenced_column_name IS NOT NULL""", [table_name]) constraints.extend(cursor.fetchall())