SQLite can't introspect recursive fks
|Reported by:||charettes||Owned by:||aaugustin|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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').
Change History (4)
Changed 3 years ago by charettes
comment:1 Changed 3 years ago by aaugustin
- Component changed from ORM aggregation to Database layer (models, ORM)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to Bug
comment:2 Changed 3 years ago by aaugustin
- Owner changed from nobody to aaugustin
- Status changed from new to assigned