#35383: Add support for `IF NOT EXISTS` when creating postgres indexes concurrently
-------------------------------------+-------------------------------------
Reporter: Marcelo | Owner: (none)
Type: New feature | Status: new
Component: contrib.postgres | Version: 5.0
Severity: Normal | Resolution:
Keywords: database, postgres, | Triage Stage:
index, concurrently | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Marcelo):
Thanks for your reply Adam Johnson;
> In my opinion, your use case goes too far beyond Django to inform any
changes to the framework.
I agree that my project is complex, yet this isn't something unseen on a
big Django project.
But I would prefer to not focus on my individual case, because I think
this goes beyond what I do and how I deploy my project.
Django already, at present, provides mechanisms for users to have a more
granular control of how they want to manage schema changes.
For example, we have `SeparateDatabaseAndState` and we also have the
management command `--run-syncdb`.
I think that making the `CREATE INDEX CONCURRENTLY` command idempotent by
adding the _option_ for a conditional `IF NOT EXISTS` (see implementation
details on the attached PR) would be a good improvement towards having a
little bit more control over how the schema editor behaviour.
Let me know if that makes sense.
> That’s not true for CREATE INDEX
Yes, but it is true that the other commands are all idempotent, including
the extension creation command which isn't in that class.
I don't know why CREATE INDEX wasn't made so from the gate go, it seems
like the exception, not the rule.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35383#comment:2>