Related: https://code.djangoproject.com/ticket/32780
--
Ticket URL: <https://code.djangoproject.com/ticket/32781>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Mariusz Felisiak):
I don't think we should make it a noop. On other databases (MySQL, Oracle)
it creates a unique constraint without `opclasses` as
[https://docs.djangoproject.com/en/3.2/ref/models/constraints/#opclasses
documented]: ''"opclasses are ignored for databases besides PostgreSQL"''
and IMO expected. `opclasses` are really PostgreSQL-specific and on other
databases default operators are just fine.
--
Ticket URL: <https://code.djangoproject.com/ticket/32781#comment:1>
Comment (by Simon Charette):
> `opclasses` are really PostgreSQL-specific and on other databases
default operators are just fine.
+1 to that, IMO `Index.opclasses` should be deprecated in favour of the
PostgreSQL only `OpClass` expression.
--
Ticket URL: <https://code.djangoproject.com/ticket/32781#comment:2>
* status: assigned => closed
* resolution: => invalid
Comment:
> I don't think we should make it a noop. On other databases (MySQL,
Oracle) it creates a unique constraint without opclasses
You're right. I'll close this ticket as the current behaviour on SQLite
when opclasses are specified is to recreate the table with a unique
constraint while ignoring `opclasses` instead of adding a unique index and
this is probably the expected behaviour if expressions or conditions
aren't used.
> +1 to that, IMO Index.opclasses should be deprecated in favour of the
PostgreSQL only OpClass expression.
Yup! Feels like we have a bunch of index-related stuff that should be
deprecated. In addition to the `opclasses` argument;
`Meta.index_together`, `Meta.unique_together` and possibly even
`Index.fields` as we adapt `Index.contains_expressions` to ignore things
that resolve to a `Col`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32781#comment:3>