From f8e8853b51476af1cc75a229dadc990c9ccf45ec Mon Sep 17 00:00:00 2001 From: peterfarrell Date: Mon, 13 Apr 2015 16:54:04 -0400 Subject: [PATCH] Fixed #24637 -- Fixed database introspection with SQLite 3.8.9. --- django/db/backends/sqlite3/introspection.py | 5 ++++- docs/releases/1.7.8.txt | 8 ++++++++ docs/releases/1.8.1.txt | 3 +++ docs/releases/index.txt | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docs/releases/1.7.8.txt diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 5f3fb4a45d..1b84d12ac5 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -239,7 +239,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): constraints = {} # Get the index info cursor.execute("PRAGMA index_list(%s)" % self.connection.ops.quote_name(table_name)) - for number, index, unique in cursor.fetchall(): + for row in cursor.fetchall(): + # Sqlite3 3.8.9+ has 5 columns, however older versions only give 3 + # columns. Discard last 2 columns if there. + number, index, unique = row[:3] # Get the index info for that index cursor.execute('PRAGMA index_info(%s)' % self.connection.ops.quote_name(index)) for index_rank, column_rank, column in cursor.fetchall(): diff --git a/docs/releases/1.7.8.txt b/docs/releases/1.7.8.txt new file mode 100644 index 0000000000..a17904f45b --- /dev/null +++ b/docs/releases/1.7.8.txt @@ -0,0 +1,8 @@ +========================== +Django 1.7.7 release notes +========================== + +*Under development* + +Django 1.7.8 fixes database introspection with SQLite 3.8.9 (released April 8, +2015) (:ticket:`24637`). diff --git a/docs/releases/1.8.1.txt b/docs/releases/1.8.1.txt index 988a532a89..9d7c5add38 100644 --- a/docs/releases/1.8.1.txt +++ b/docs/releases/1.8.1.txt @@ -41,3 +41,6 @@ Bugfixes * Fixed a crash with ``QuerySet.update()`` on foreign keys to instances with ``uuid`` primary keys (:ticket:`24611`). + +* Fixed database introspection with SQLite 3.8.9 (released April 8, 2015) + (:ticket:`24637`). diff --git a/docs/releases/index.txt b/docs/releases/index.txt index b66f5e0fff..516b451f50 100644 --- a/docs/releases/index.txt +++ b/docs/releases/index.txt @@ -40,6 +40,7 @@ versions of the documentation contain the release notes for any later releases. .. toctree:: :maxdepth: 1 + 1.7.8 1.7.7 1.7.6 1.7.5