Added flag to check before adding 'IF NOT EXISTS' and 'OR REPLACE' clause to the SQL. While creating any object the respective clause should not be added.

This commit is contained in:
Nikhil Mohite
2021-09-22 19:14:19 +05:30
committed by Akshay Joshi
parent 05ce3445b5
commit f192be3667
373 changed files with 485 additions and 441 deletions

View File

@@ -501,7 +501,8 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
),
data=result,
conn=self.conn,
display_comments=True
display_comments=True,
add_not_exists_clause=True
)
if not json_resp:

View File

@@ -7,7 +7,7 @@
{% endif %}
{% if data.name %}
CREATE EXTENSION IF NOT EXISTS {{ conn|qtIdent(data.name) }}{% if data.schema == '' and data.version == '' %};{% endif %}
CREATE EXTENSION{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.name) }}{% if data.schema == '' and data.version == '' %};{% endif %}
{% if data.schema %}
SCHEMA {{ conn|qtIdent(data.schema) }}{% if data.version == '' %};{% endif %}

View File

@@ -1,3 +1,3 @@
CREATE EXTENSION IF NOT EXISTS sslinfo
CREATE EXTENSION sslinfo
SCHEMA test_extension_schema
VERSION "1.0";

View File

@@ -1,2 +1,2 @@
CREATE EXTENSION IF NOT EXISTS citext
CREATE EXTENSION citext
VERSION "1.0";

View File

@@ -1,3 +1,3 @@
CREATE EXTENSION IF NOT EXISTS sslinfo
CREATE EXTENSION sslinfo
SCHEMA test_extension_schema
VERSION "1.0";

View File

@@ -1,3 +1,3 @@
CREATE EXTENSION IF NOT EXISTS sslinfo
CREATE EXTENSION sslinfo
SCHEMA test_extension_schema
VERSION "1.2";

View File

@@ -1,2 +1,2 @@
CREATE EXTENSION IF NOT EXISTS adminpack
CREATE EXTENSION adminpack
VERSION "1.0";