#35383: Add support for `IF NOT EXISTS` when creating postgres indexes
concurrently
-------------------------------------+-------------------------------------
Reporter: | Owner: (none)
marcelofern |
Type: New | Status: new
feature |
Component: | Version: 5.0
contrib.postgres | Keywords: database, postgres,
Severity: Normal | index, concurrently
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi.
The code for `CREATE INDEX CONCURRENTLY` does not allow for the `IF NOT
EXISTS` conditional.
This is not consistent with the pattern for other schema-change
operations, which already include either `IF NOT EXISTS` or `IF EXISTS` so
that changes fail without error. For example, check the
DatabaseSchemaEditor queries at `django/db/backends/postgresql/schema.py`
This is particularly important in my case. I have the same Django project
being deployed in different regions of the world.
I'd like to create the index concurrently out-of-business hours, which
varies depending on the country. Following that, I'd like to create the
migration file so that all environments are in sync.
However, if the `IF NOT EXISTS` is not available, those migrations won't
be idempotent.
There is an open PR that attempts to address this:
https://github.com/django/django/pull/18081
--
Ticket URL: <https://code.djangoproject.com/ticket/35383>
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/0107018eeddc2a00-2112630c-d383-43e1-949c-bc59665260eb-000000%40eu-central-1.amazonses.com.