#24637 closed Bug (fixed)
get_constraints broke on newer version of sqlite.
Description ¶
Running the test suite with the latest version of sqlite "3.8.9" gives the following error. The way sqlite brings back constraints change between the two versions.
ERROR: test_unique_together_meta (inspectdb.tests.InspectDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/sthompso/PycharmProjects/django/tests/inspectdb/tests.py", line 225, in test_unique_together_meta stdout=out) File "/Users/sthompso/PycharmProjects/django/django/core/management/__init__.py", line 118, in call_command return command.execute(*args, **defaults) File "/Users/sthompso/PycharmProjects/django/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/Users/sthompso/PycharmProjects/django/django/core/management/commands/inspectdb.py", line 25, in handle for line in self.handle_inspection(options): File "/Users/sthompso/PycharmProjects/django/django/core/management/commands/inspectdb.py", line 69, in handle_inspection constraints = connection.introspection.get_constraints(cursor, table_name) File "/Users/sthompso/PycharmProjects/django/django/db/backends/sqlite3/introspection.py", line 242, in get_constraints for number, index, unique in cursor.fetchall(): ValueError: too many values to unpack
Change History (11)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
The new version of 3.8.9 returns 5 columns while we are relying that is only has 3 columns.
comment:4 by , 10 years ago
The original reporter was on OSX as I helped him with this is at PyCon Sprints. I can confirm that upgrading from Sqlite3 3.8.2 to 3.8.9 on Ubuntu 14 causes the above issue. This issue is reproducible. Sqlite 3.8.9 was released on April 8, 2015. I had to install it from source on Ubuntu.
comment:5 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I have a PR in progress that works for both behaviors.
comment:7 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.8 → master |
comment:8 by , 10 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
It appears that database.index_list() in sqlite3 has changed:
Current documentation for the latest release 3.8.9:
http://www.sqlite.org/pragma.html#pragma_index_list
Older documentation (don't know which version exactly but shows what Django is relying on):
https://www.safaribooksonline.com/library/view/using-sqlite/9781449394592/re183.html