Opened 12 years ago
Closed 12 years ago
#19677 closed Bug (fixed)
SQLite can't introspect recursive fks
Reported by: | Simon Charette | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
SQLite's get_key_columns
relies on the presence of inline REFERENCES
clauses in table definitions to work properly.
However, since those are not created by BaseDatabaseCreation.sql_for_inline_foreign_key_references
for recursive fks and there's no support for foreign keys on SQLite yet, sql_for_pending_references
does nothing.
I'm attaching a patch that makes sure to add references on table creation with introspection assertions. It passes on all elements of product(['Python 2.7.3 ', 'Python 3.2.3 '], ['SQLite3', 'Postgresql 9.1'])
I stumbled upon this issue while trying to write tests for #19676 under a TestCase which @skipUnlessDBFeature('can_introspect_foreign_keys')
.
Attachments (1)
Change History (4)
by , 12 years ago
Attachment: | 0001-Fixed-19677-Create-inline-references-for-recursive-f.patch added |
---|
comment:1 by , 12 years ago
Component: | ORM aggregation → Database layer (models, ORM) |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I'll update the test and commit the patch.
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Tests don't pass out of the box but it appears to be a simple ordering issue: