The where='sql expression' is inserted directly into the CREATE INDEX statement when a migration runs. It must be valid for the currently active database backend.
While the django-partial-index project supports both PostgreSQL and SQLite, they have slightly different expected syntax for some expressions.
This means that where-expressions for the common case of filtering on a boolean flag need two different expressions in a project that uses PostgreSQL in production and SQLite in testing.
Proposed solution:
where='' is used for both backends,
where_postgresql='' and where_sqlite='' can be used instead to provide different expressions,
Only one of them can be provided if the developer is not aiming to support both backends,
It's up to the developer to ensure that their behaviour is identical,
For consistency, where='' cannot be used if either or both where_='' are provided,
For consistency, where_='' expressions must be different; if they are identical you must use where=''.
The where='sql expression' is inserted directly into the CREATE INDEX statement when a migration runs. It must be valid for the currently active database backend.
While the django-partial-index project supports both PostgreSQL and SQLite, they have slightly different expected syntax for some expressions.
In a particularly common case, they differ in valid boolean literals: SQLite only accepts 0 and 1 as numbers, and PostgreSQL only accepts TRUE, FALSE and a few string values: https://www.postgresql.org/docs/9.1/static/datatype-boolean.html
This means that where-expressions for the common case of filtering on a boolean flag need two different expressions in a project that uses PostgreSQL in production and SQLite in testing.
Proposed solution: