summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 8f2653c74..9b6c632da 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -2380,6 +2380,9 @@ class PGDDLCompiler(compiler.DDLCompiler):
if concurrently:
text += "CONCURRENTLY "
+ if create.if_not_exists:
+ text += "IF NOT EXISTS "
+
text += "%s ON %s " % (
self._prepared_index_name(index, include_schema=False),
preparer.format_table(index.table),
@@ -2463,6 +2466,9 @@ class PGDDLCompiler(compiler.DDLCompiler):
if concurrently:
text += "CONCURRENTLY "
+ if drop.if_exists:
+ text += "IF EXISTS "
+
text += self._prepared_index_name(index, include_schema=True)
return text