![]() I think it should be done for all backends that support it on field addition. That's because SQLite doesn't support ALTER TABLE ADD CONSTRAINT the table has to be rebuilt on column addition so the only way to define foreign constraints is by inlining them. Perhaps the code could be refactored so that the postgresql backend only applies the sql_create_inline_fk optimization in add_field (which is when this scenario can occur) and not in create_model (when it shouldn't matter, because a table scan on an empty table is not problematic).įirst, thanks for the very detailed report and the patch.įor posterity here are similar comments to the ones I left on your Github PR. Psycopg2.ProgrammingError: relation "mutually_referential_child" does not exist It seems that SQLite doesn't mind if you create a table with a foreign key to another table that doesn't exist yet, but PostgreSQL does. Unfortunately this ended up causing test failures because there are test models defined with a cyclic dependency.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |