Custom SQL fixtures appear to be loaded in the wrong order.
|Reported by:||David Rogers||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When using custom SQL fixtures for loading SQL into the database (i.e. a VIEW for an unmanaged Model class or SQL INSERT / UPDATE statements), there are two filenames that can be used:
The latter is reserved for RDBMS-specific SQL statements that might differ from the standard, such as use of
CREATE RULE for VIEWs in Postgres vice
CREATE TRIGGER in SQLite. If _both_ files are used, the order in which the two are loaded and passed to the database is undesirable.
EXPECTED: If I use both a generic SQL fixture _and_ a RDBMS-specific SQL fixture, the generic fixture should be loaded first (i.e. for VIEW or TABLE definitions), then the other.
ACTUAL: Django consistently loads the driver-specific file _before_ the generic SQL fixture, instead. This can lead to unnecessary code duplication or failure.