diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2020-12-14 16:35:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-12-14 16:35:56 +0000 |
commit | aa47eca615eaf8277f6a6365a05539fda1b725e2 (patch) | |
tree | 28567a48673024bd80473ff0a62f3f82a4ccc2f3 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | 8d3254b6727b306e19dd0db299586b95caa46c9e (diff) | |
parent | 0d50b0c7c5b0a9fda4c962f09900e45bebeb1a02 (diff) | |
download | sqlalchemy-aa47eca615eaf8277f6a6365a05539fda1b725e2.tar.gz |
Merge "Support IF EXISTS/IF NOT EXISTS for DDL constructs"
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 6 |
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 |