﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34729	Add explicit option to enable IF EXISTS / IF NOT EXISTS in PostgresQL index operations	Laurent Tramoy		"Hello, 

I'd like to be able to add a `IF NOT EXISTS` clause when creating indexes (both with AddIndex and AddIndexConcurrently). 

I've read this ticket https://code.djangoproject.com/ticket/34298 where Mariusz considers it's a bad idea (for constraints), and I get his point, however I've a few counter arguments: 
* I feel like the workflow ""add an index in a deployed environment /  check it works as expected / add it to Django code"" is quite common in ""real-life"" applications, for now we have to write a custom `SeparateDatabaseAndState` each time we do this
* The idea would be to enable this explicitly (either by adding a `AddIndexIfNotExists` operation, or by adding a parameter to `AddIndex` / `AddIndexConcurrently`), so people should know what they're doing when using this. 
* The `IF EXISTS` clause is already used  when dropping the index, it would be more consistent to be able to allow it when adding the index too [https://github.com/django/django/blob/afc880571d5f5a16b977070b15014f9583524898/django/db/backends/postgresql/schema.py#L25]"	New feature	closed	contrib.postgres	4.2	Normal	wontfix			Unreviewed	0	0	0	0	0	0
