#34898: Adding non-deterministic collations to unique CharFields crashes on
PostgreSQL.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Tom
| Carrick
Type: Bug | Status: assigned
Component: Migrations | Version: 4.2
Severity: Normal | Resolution:
Keywords: PostgreSQL | Triage Stage: Accepted
collation |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Tom Carrick):
The opposite case works fine because there's no index yet. The user is
adding an index, so it's expected that the index gets created, and of
course we need it without `varchar_pattern_ops`.
In this case though, the user already has a `varchar_pattern_ops` index.
Postgres offers no way to alter an existing index, it's drop and recreate
only, so we need to drop the index, change the collation, then add the
index again but without `varchar_patterm_ops`. My concern here is not that
it's difficult, it's that we're performing potentially expensive
operations without informing the user about them (as they don't show up in
the migration file, or anywhere else). Ideally the user should know they
can't use `varchar_pattern_ops` with a non-deterministic collation, but
`db_index` and `unique` are quite opaque about what is actually happening,
relative to the more explicit `Meta.indexes` and `Meta.constraints`, so
it's hard for them to know (unless it's very explicitly documented
somewhere) what the consequences are of changing the collation in this
scenario.
--
Ticket URL: <https://code.djangoproject.com/ticket/34898#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018bd27e7222-d3a810b9-20d9-4789-9d68-1fd12b242049-000000%40eu-central-1.amazonses.com.