diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/sql/9.3_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/sql/9.3_plus/create.sql
index b195b580..07de9b92 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/sql/9.3_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/sql/9.3_plus/create.sql
@@ -4,4 +4,4 @@ CREATE EVENT TRIGGER {{ conn|qtIdent(data.name) }} ON {{data.eventname}}
     WHEN TAG IN ({{data.when}})
 {% endif %}
     EXECUTE PROCEDURE {{data.eventfunname}}();
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
index 8a202034..ebccde4e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/__init__.py
@@ -501,7 +501,8 @@ class ExtensionView(PGChildNodeView, SchemaDiffObjectCompare):
         ),
             data=result,
             conn=self.conn,
-            display_comments=True
+            display_comments=True,
+            if_exists=True
         )
 
         if not json_resp:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/sql/create.sql
index 037235a2..c7ab0aa9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/sql/create.sql
@@ -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 if_exists %} 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 %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_all_options.sql
index 0a341809..108c1e11 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_all_options.sql
@@ -1,3 +1,3 @@
-CREATE EXTENSION IF NOT EXISTS sslinfo
+CREATE EXTENSION sslinfo
     SCHEMA test_extension_schema
     VERSION "1.0";
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_default_schema.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_default_schema.sql
index a936f441..97082266 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_default_schema.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.4_plus/msql_create_extension_with_default_schema.sql
@@ -1,2 +1,2 @@
-CREATE EXTENSION IF NOT EXISTS citext
+CREATE EXTENSION citext
     VERSION "1.0";
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.5_plus/msql_create_extension_with_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.5_plus/msql_create_extension_with_all_options.sql
index 0a341809..108c1e11 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.5_plus/msql_create_extension_with_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.5_plus/msql_create_extension_with_all_options.sql
@@ -1,3 +1,3 @@
-CREATE EXTENSION IF NOT EXISTS sslinfo
+CREATE EXTENSION sslinfo
     SCHEMA test_extension_schema
     VERSION "1.0";
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_all_options.sql
index d584542e..68217d76 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_all_options.sql
@@ -1,3 +1,3 @@
-CREATE EXTENSION IF NOT EXISTS sslinfo
+CREATE EXTENSION sslinfo
     SCHEMA test_extension_schema
     VERSION "1.2";
diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_default_schema.sql b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_default_schema.sql
index ed8cadf3..02c109f1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_default_schema.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/9.6_plus/msql_create_extension_with_default_schema.sql
@@ -1,2 +1,2 @@
-CREATE EXTENSION IF NOT EXISTS adminpack
+CREATE EXTENSION adminpack
     VERSION "1.0";
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
index 321462d1..f49aa251 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py
@@ -773,7 +773,7 @@ class LanguageView(PGChildNodeView, SchemaDiffObjectCompare):
         old_data['seclabels'] = seclabels
         sql = render_template(
             "/".join([self.template_path, 'sqlpane.sql']),
-            data=old_data, conn=self.conn
+            data=old_data, conn=self.conn, if_replace=True
         )
 
         if not json_resp:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/9.3_plus/sqlpane.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/9.3_plus/sqlpane.sql
index e5ac14a7..3b5ada81 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/9.3_plus/sqlpane.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/9.3_plus/sqlpane.sql
@@ -2,10 +2,10 @@
 {% import 'macros/security.macros' as SECLABEL %}
 -- Language: {{data.name}}
 
--- DROP LANGUAGE {{ conn|qtIdent(data.name) }}
+-- DROP LANGUAGE IF EXISTS {{ conn|qtIdent(data.name) }}
 
 {# ============= CREATE LANGUAGE Query ============= #}
-CREATE{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
+CREATE{% if if_replace %} OR REPLACE{% endif %}{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
 {% if data.lanproc %}
     HANDLER {{ conn|qtIdent(data.lanproc) }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/create.sql
index b85760d1..9dadc1e5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/create.sql
@@ -2,9 +2,9 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% import 'macros/security.macros' as SECLABEL %}
 {% if data.is_template %}
-CREATE LANGUAGE {{ conn|qtIdent(data.name) }};
+CREATE{% if if_replace %} OR REPLACE{% endif %} LANGUAGE {{ conn|qtIdent(data.name) }};
 {% else %}
-CREATE{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
+CREATE{% if if_replace %} OR REPLACE{% endif %}{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
 {% if data.lanproc %}
     HANDLER {{ conn|qtIdent(data.lanproc) }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/sqlpane.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/sqlpane.sql
index e5ac14a7..3b5ada81 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/sqlpane.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/sql/default/sqlpane.sql
@@ -2,10 +2,10 @@
 {% import 'macros/security.macros' as SECLABEL %}
 -- Language: {{data.name}}
 
--- DROP LANGUAGE {{ conn|qtIdent(data.name) }}
+-- DROP LANGUAGE IF EXISTS {{ conn|qtIdent(data.name) }}
 
 {# ============= CREATE LANGUAGE Query ============= #}
-CREATE{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
+CREATE{% if if_replace %} OR REPLACE{% endif %}{% if data.trusted %} TRUSTED{% endif %} PROCEDURAL LANGUAGE {{ conn|qtIdent(data.name) }}
 {% if data.lanproc %}
     HANDLER {{ conn|qtIdent(data.lanproc) }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_comment_privileges.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_comment_privileges.sql
index acc99758..ea919102 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_comment_privileges.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_comment_privileges.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_revoke_privileges.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_revoke_privileges.sql
index fe707216..d162b2a5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_revoke_privileges.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_revoke_privileges.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_trusted_lan_name.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_trusted_lan_name.sql
index d9c28893..cbffc2c8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_trusted_lan_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/alter_trusted_lan_name.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_trusted_language.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_trusted_language.sql
index 9b5ff05e..01b51217 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_trusted_language.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_trusted_language.sql
@@ -1,8 +1,8 @@
 -- Language: Lan1_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan1_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_untrusted_language.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_untrusted_language.sql
index b2890ba4..0e3f357f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_untrusted_language.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/pg/9.4_plus/create_untrusted_language.sql
@@ -1,8 +1,8 @@
 -- Language: Lan1_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan1_$%{}[]()&*^!@""'`\/#"
 
-CREATE PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_comment_privileges.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_comment_privileges.sql
index d10230a8..9fe749e8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_comment_privileges.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_comment_privileges.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_revoke_privileges.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_revoke_privileges.sql
index fe707216..d162b2a5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_revoke_privileges.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_revoke_privileges.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_trusted_lan_name.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_trusted_lan_name.sql
index d9c28893..cbffc2c8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_trusted_lan_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/alter_trusted_lan_name.sql
@@ -1,8 +1,8 @@
 -- Language: Lan2_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan2_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan2_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_trusted_language.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_trusted_language.sql
index 9b5ff05e..01b51217 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_trusted_language.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_trusted_language.sql
@@ -1,8 +1,8 @@
 -- Language: Lan1_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan1_$%{}[]()&*^!@""'`\/#"
 
-CREATE TRUSTED PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE TRUSTED PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_untrusted_language.sql b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_untrusted_language.sql
index b2890ba4..0e3f357f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_untrusted_language.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/tests/ppas/9.4_plus/create_untrusted_language.sql
@@ -1,8 +1,8 @@
 -- Language: Lan1_$%{}[]()&*^!@"'`\/#
 
--- DROP LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+-- DROP LANGUAGE IF EXISTS "Lan1_$%{}[]()&*^!@""'`\/#"
 
-CREATE PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
+CREATE OR REPLACE PROCEDURAL LANGUAGE "Lan1_$%{}[]()&*^!@""'`\/#"
     HANDLER plpgsql_call_handler
     INLINE plpgsql_inline_handler
     VALIDATOR plpgsql_validator;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index 26d46528..27c2db04 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -864,7 +864,7 @@ It may have been removed by another user.
         SQL = render_template(
             "/".join([self.template_path,
                       self._SQL_PREFIX + self._CREATE_SQL]),
-            _=gettext, data=data, conn=self.conn
+            _=gettext, data=data, conn=self.conn, if_exists=True
         )
 
         sql_header = "-- SCHEMA: {0}\n\n-- ".format(data['name'])
@@ -1048,7 +1048,7 @@ It may have been removed by another user.
         SQL = render_template(
             "/".join([self.template_path,
                       self._SQL_PREFIX + self._CREATE_SQL]),
-            _=gettext, data=old_data, conn=self.conn
+            _=gettext, data=old_data, conn=self.conn, if_exists=True
         )
 
         sql_header = """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
index ca941cb5..66638c70 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/__init__.py
@@ -725,7 +725,9 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
 
         SQL = render_template("/".join([self.template_path,
                                         self._CREATE_SQL]),
-                              data=data, conn=self.conn)
+                              data=data, conn=self.conn,
+                              if_exists=True
+                              )
 
         sql_header = "-- Collation: {0};\n\n-- ".format(data['name'])
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/10_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/10_plus/create.sql
index c36189ef..2185eac1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/10_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/10_plus/create.sql
@@ -1,5 +1,5 @@
 {% if data %}
-CREATE COLLATION {{ conn|qtIdent(data.schema, data.name) }}
+CREATE COLLATION{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
 {# if user has provided lc_collate & lc_type #}
 {% if data.lc_collate and data.lc_type %}
     (LC_COLLATE = {{ data.lc_collate|qtLiteral }}, LC_CTYPE = {{ data.lc_type|qtLiteral }});
@@ -22,4 +22,4 @@ ALTER COLLATION {{ conn|qtIdent(data.schema, data.name) }}
 COMMENT ON COLLATION {{ conn|qtIdent(data.schema, data.name) }}
     IS {{ data.description|qtLiteral }};
 {% endif %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/default/create.sql
index 0a937088..755dc583 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collations/sql/default/create.sql
@@ -1,9 +1,9 @@
 {% if data %}
 {% if not data.lc_collate and not data.lc_type and not data.locale and not data.copy_collation %}
-CREATE COLLATION {{ conn|qtIdent(data.schema, data.name) }}
+CREATE COLLATION{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
     FROM pg_catalog."default";
 {% else %}
-CREATE COLLATION {{ conn|qtIdent(data.schema, data.name) }}
+CREATE COLLATION{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
 {% endif %}
 {# if user has provided lc_collate & lc_type #}
 {% if data.lc_collate and data.lc_type %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/alter_collation.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/alter_collation.sql
index 1b6b0c8f..f312becb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/alter_collation.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/alter_collation.sql
@@ -2,7 +2,7 @@
 
 -- DROP COLLATION IF EXISTS testschema."Cl1_$%{}[]()&*^!@""'`\/#a";
 
-CREATE COLLATION testschema."Cl1_$%{}[]()&*^!@""'`\/#a"
+CREATE COLLATION IF NOT EXISTS testschema."Cl1_$%{}[]()&*^!@""'`\/#a"
     (LC_COLLATE = 'C', LC_CTYPE = 'C');
 
 ALTER COLLATION testschema."Cl1_$%{}[]()&*^!@""'`\/#a"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/create_collation.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/create_collation.sql
index 8cd07121..66772054 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/create_collation.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/tests/default/create_collation.sql
@@ -2,7 +2,7 @@
 
 -- DROP COLLATION IF EXISTS testschema."Cl1_$%{}[]()&*^!@""'`\/#";
 
-CREATE COLLATION testschema."Cl1_$%{}[]()&*^!@""'`\/#"
+CREATE COLLATION IF NOT EXISTS testschema."Cl1_$%{}[]()&*^!@""'`\/#"
     (LC_COLLATE = 'C', LC_CTYPE = 'C');
 
 ALTER COLLATION testschema."Cl1_$%{}[]()&*^!@""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
index 1ee67f13..39f52931 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/__init__.py
@@ -901,7 +901,9 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
 
         SQL = render_template("/".join([self.template_path,
                                         self._CREATE_SQL]),
-                              data=data, is_sql=True)
+                              data=data, is_sql=True,
+                              if_exists=True
+                              )
 
         if not json_resp:
             return SQL.strip('\n')
@@ -1160,7 +1162,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
 
         return cols
 
-    def _fetch_properties(self, gid, sid, did, scid, foid, inherits=False):
+    def _fetch_properties(self, gid, sid, did, scid, foid, inherits=False, ):
         """
         Returns the Foreign Table properties which will be used in
         properties, sql and get_sql functions.
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/delete.sql
index 39a11c95..8b0af2dc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/delete.sql
@@ -13,5 +13,5 @@ AND
 
 
 {% if name %}
-DROP FOREIGN TABLE {{ conn|qtIdent(basensp, name) }}{% if cascade%} CASCADE{% endif %};
+DROP FOREIGN TABLE IF EXISTS {{ conn|qtIdent(basensp, name) }}{% if cascade%} CASCADE{% endif %};
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/create.sql
index f0a5a501..b7d99054 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/create.sql
@@ -2,7 +2,7 @@
 {% import 'macros/schemas/privilege.macros' as PRIVILEGE %}
 {% set is_columns = [] %}
 {% if data %}
-CREATE FOREIGN TABLE IF NOT EXISTS {{ conn|qtIdent(data.basensp, data.name) }}(
+CREATE FOREIGN TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.basensp, data.name) }}(
 {% if data.columns %}
 {% for c in data.columns %}
 {% if (not c.inheritedfrom or c.inheritedfrom =='' or  c.inheritedfrom == None or  c.inheritedfrom == 'None' ) %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
index e34638db..7f855ed7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/create.sql
@@ -1,6 +1,6 @@
 {% import 'macros/schemas/security.macros' as SECLABEL %}
 {% if data %}
-CREATE FOREIGN TABLE {{ conn|qtIdent(data.basensp, data.name) }}(
+CREATE FOREIGN TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.basensp, data.name) }}(
 {% if data.columns %}
 {% for c in data.columns %}
     {{conn|qtIdent(c.attname)}} {% if is_sql %}{{ c.fulltype }}{% else %}{{ c.datatype }}{% if c.typlen %}({{c.typlen}} {% if c.precision %}, {{c.precision}}{% endif %}){% endif %}{% if c.isArrayType %}[]{% endif %}{% endif %}{% if c.attnotnull %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/delete.sql
index 78a97dfd..009ade25 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/default/delete.sql
@@ -11,5 +11,5 @@ WHERE
 {% endif %}
 
 {% if name %}
-DROP FOREIGN TABLE {{ conn|qtIdent(basensp, name) }}{% if cascade %} CASCADE{% endif %};
+DROP FOREIGN TABLE IF EXISTS {{ conn|qtIdent(basensp, name) }}{% if cascade %} CASCADE{% endif %};
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.2_plus/create_foreign_table_with_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.2_plus/create_foreign_table_with_all_options.sql
index 3ed0e662..1a09bfd5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.2_plus/create_foreign_table_with_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.2_plus/create_foreign_table_with_all_options.sql
@@ -2,7 +2,7 @@
 
 -- DROP FOREIGN TABLE public."FT1_$%{}[]()&*^!@""'`\/#";
 
-CREATE FOREIGN TABLE public."FT1_$%{}[]()&*^!@""'`\/#"(
+CREATE FOREIGN TABLE IF NOT EXISTS public."FT1_$%{}[]()&*^!@""'`\/#"(
     col1 bigint NULL,
     col2 text NULL COLLATE pg_catalog."default"
 )
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.6_plus/create_foreign_table_with_all_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.6_plus/create_foreign_table_with_all_options_msql.sql
index de737918..13494a79 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.6_plus/create_foreign_table_with_all_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/pg/9.6_plus/create_foreign_table_with_all_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE FOREIGN TABLE IF NOT EXISTS public."FT1_$%{}[]()&*^!@""'`\/#"(
+CREATE FOREIGN TABLE public."FT1_$%{}[]()&*^!@""'`\/#"(
     col1 bigint NULL,
     col2 text NULL
 )
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.2_plus/create_foreign_table_with_all_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.2_plus/create_foreign_table_with_all_options_msql.sql
index a532ed22..20409f9b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.2_plus/create_foreign_table_with_all_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.2_plus/create_foreign_table_with_all_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE FOREIGN TABLE IF NOT EXISTS public."FT1_$%{}[]()&*^!@""'`\/#"(
+CREATE FOREIGN TABLE public."FT1_$%{}[]()&*^!@""'`\/#"(
     col1 bigint NULL,
     col2 text NULL
 )
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.6_plus/create_foreign_table_with_all_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.6_plus/create_foreign_table_with_all_options_msql.sql
index f7c80113..dd1f2543 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.6_plus/create_foreign_table_with_all_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/tests/ppas/9.6_plus/create_foreign_table_with_all_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE FOREIGN TABLE IF NOT EXISTS public."FT1_$%{}[]()&*^!@""'`\/#"(
+CREATE FOREIGN TABLE public."FT1_$%{}[]()&*^!@""'`\/#"(
     col1 bigint NULL,
     col2 text NULL
 )
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index 11becf07..36cf3d0d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -1099,7 +1099,9 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
                                              self._CREATE_SQL]),
                                    data=resp_data, query_type="create",
                                    func_def=name_with_default_args,
-                                   query_for="sql_panel")
+                                   query_for="sql_panel",
+                                   if_replace=True
+                                   )
 
         return func_def
 
@@ -1219,7 +1221,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
             object_type.upper(), resp_data['pronamespace'],
             resp_data['proname'],
             resp_data['proargtypenames'].lstrip('(').rstrip(')'))
-        sql_header += """-- DROP {0} {1}({2});\n\n""".format(
+        sql_header += """-- DROP {0} IF EXISTS {1}({2});\n\n""".format(
             object_type.upper(), self.qtIdent(
                 self.conn, resp_data['pronamespace'], resp_data['proname']),
             resp_data['proargtypenames'].lstrip('(').rstrip(')'))
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/create.sql
index 0cffba3a..4d94c38b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/create.sql
@@ -7,7 +7,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/11_plus/create.sql
index 2ba16e51..7b2586c5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/11_plus/create.sql
@@ -7,7 +7,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.2_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.2_plus/create.sql
index 57f7c7c9..b0d16958 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.2_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.2_plus/create.sql
@@ -6,7 +6,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
  {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.5_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.5_plus/create.sql
index 4a2a9462..8aaba78e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.5_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.5_plus/create.sql
@@ -7,7 +7,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.6_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.6_plus/create.sql
index a533b7de..7fa5b4fc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.6_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/9.6_plus/create.sql
@@ -7,7 +7,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/create.sql
index a548d7f2..511a1414 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/create.sql
@@ -6,7 +6,7 @@
 {% if query_for == 'sql_panel' and func_def is defined %}
 CREATE OR REPLACE PROCEDURE {{func_def}}
 {% else %}
-CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
+CREATE{% if if_replace %} OR REPLACE{% endif %} PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% if data.arguments is defined %}
 ({% for p in data.arguments %}{% if p.argmode %}{{p.argmode}} {% endif %}{% if p.argname %}{{ conn|qtIdent(p.argname)}} {% endif %}{% if p.argtype %}{{ p.argtype }}{% endif %}{% if p.argdefval %} DEFAULT {{p.argdefval}}{% endif %}
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/11_plus/create.sql
index 6c3164c3..fa98eefa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/11_plus/create.sql
@@ -4,7 +4,7 @@
 {% set is_columns = [] %}
 {% set exclude_quoting = ['search_path'] %}
 {% if data %}
-CREATE OR REPLACE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
+CREATE{% if if_replace %} OR REPLACE{% endif %} FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
     RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
 
     LANGUAGE {{ data.lanname|qtLiteral }}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.2_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.2_plus/create.sql
index b14effa9..3d41a680 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.2_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.2_plus/create.sql
@@ -4,7 +4,7 @@
 {% set is_columns = [] %}
 {% set exclude_quoting = ['search_path'] %}
 {% if data %}
-CREATE OR REPLACE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
+CREATE{% if if_replace %} OR REPLACE{% endif %} FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
     RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
 
     LANGUAGE {{ data.lanname|qtLiteral }}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.5_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.5_plus/create.sql
index 6c3164c3..fa98eefa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.5_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/9.5_plus/create.sql
@@ -4,7 +4,7 @@
 {% set is_columns = [] %}
 {% set exclude_quoting = ['search_path'] %}
 {% if data %}
-CREATE OR REPLACE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
+CREATE{% if if_replace %} OR REPLACE{% endif %} FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({% if data.proargnames %}{{data.proargnames}}{% endif %})
     RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
 
     LANGUAGE {{ data.lanname|qtLiteral }}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/create.sql
index 87be90cd..e619a1b5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/create.sql
@@ -4,7 +4,7 @@
 {% set is_columns = [] %}
 {% set exclude_quoting = ['search_path'] %}
 {% if data %}
-CREATE OR REPLACE FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
+CREATE{% if if_replace %} OR REPLACE{% endif %} FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}()
     RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') %} {{ data.prorettypename }}{% elif data.proretset %} SETOF {{ data.prorettypename }}{% else %} {{ data.prorettypename }}{% endif %}
 
     LANGUAGE {{ data.lanname|qtLiteral }}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_acl.sql
index 17127b49..1efff0af 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_parameter.sql
index 54fc22de..fa0038a4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_change_grantee_acl.sql
index 3e6120ff..7ed69fc9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_comment.sql
index ce622e6c..87306d16 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_acl.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_parameter.sql
index f7624d83..8e604ad5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_rename.sql
index 7bdf81a3..8ed3f8cd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_change_grantee_priv.sql
index 94af3546..e3ba35f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_comment.sql
index 86eae9ac..e29870f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_param.sql
index 4a8b0b17..d31596b1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_comment.sql
index 9538dde0..e1cfe4ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_1.sql
index 87e1f4bd..f9ab8707 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_2.sql
index 351d0ba1..dda23090 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_3.sql
index fd1d62aa..ed1e163d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_event_trigger_full.sql
index fdd0225b..50f59804 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function.sql
index 74a4a62a..7be119d6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function_for_alter.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger.sql
index 435237a0..759c632e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger_full.sql
index 5d8d9300..73040efb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_procedure.sql
index c6b64823..4156d93a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/11_plus/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_acl.sql
index 17127b49..1efff0af 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_parameter.sql
index 54fc22de..fa0038a4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_change_grantee_acl.sql
index 3e6120ff..7ed69fc9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_comment.sql
index ce622e6c..87306d16 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_acl.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_parameter.sql
index f7624d83..8e604ad5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_rename.sql
index 7bdf81a3..8ed3f8cd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_change_grantee_priv.sql
index 94af3546..e3ba35f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_comment.sql
index 86eae9ac..e29870f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_param.sql
index 4a8b0b17..d31596b1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_comment.sql
index 9538dde0..e1cfe4ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_1.sql
index 87e1f4bd..f9ab8707 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_2.sql
index 351d0ba1..dda23090 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_3.sql
index fd1d62aa..ed1e163d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_event_trigger_full.sql
index d4a84a7c..90a6c6db 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function.sql
index 74a4a62a..7be119d6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function_for_alter.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger.sql
index 435237a0..759c632e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger_full.sql
index be4e83c9..b07f721c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_procedure.sql
index c6b64823..4156d93a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/12_plus/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_acl.sql
index 6240f2d9..79d8a1fe 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_parameter.sql
index 5e67fccd..c901f8bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_change_grantee_acl.sql
index 7c951711..ead07955 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_comment.sql
index 4fa9638b..71aab9c6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_acl.sql
index d9890c1e..8f4b38ae 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_parameter.sql
index 3bfdab31..d42da98c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_rename.sql
index 320fd0a8..8f12841a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_comment.sql
index 9538dde0..e1cfe4ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_1.sql
index 87e1f4bd..f9ab8707 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_2.sql
index 351d0ba1..dda23090 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_3.sql
index fd1d62aa..ed1e163d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_event_trigger_full.sql
index fdd0225b..50f59804 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function.sql
index eb6fdbb8..2a94729d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function_for_alter.sql
index d9890c1e..8f4b38ae 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger.sql
index 435237a0..759c632e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger_full.sql
index 5d8d9300..73040efb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.5_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_acl.sql
index 17127b49..1efff0af 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_parameter.sql
index 54fc22de..fa0038a4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_change_grantee_acl.sql
index 3e6120ff..7ed69fc9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_comment.sql
index ce622e6c..87306d16 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_acl.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_parameter.sql
index f7624d83..8e604ad5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_rename.sql
index 7bdf81a3..8ed3f8cd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_comment.sql
index 9538dde0..e1cfe4ba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_1.sql
index 87e1f4bd..f9ab8707 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_2.sql
index 351d0ba1..dda23090 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_3.sql
index fd1d62aa..ed1e163d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_event_trigger_full.sql
index fdd0225b..50f59804 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function.sql
index 74a4a62a..7be119d6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function_for_alter.sql
index e8db8efb..12c8377c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger.sql
index 435237a0..759c632e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger_full.sql
index 5d8d9300..73040efb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/pg/9.6_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_acl.sql
index 5c8b5c60..fbaab278 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_parameter.sql
index 48b1c3ee..e68ca8a3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_change_grantee_acl.sql
index 4317e3d0..53a6d190 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_comment.sql
index 5070ff43..585fd010 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_acl.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_parameter.sql
index f0b0878a..31a37a1d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_rename.sql
index 0ca7cb0a..5da77049 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_change_grantee_priv.sql
index 94af3546..e3ba35f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_comment.sql
index 86eae9ac..e29870f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_param.sql
index 4a8b0b17..d31596b1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_comment.sql
index 47a2376b..15673504 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_1.sql
index a753ef0d..1981336d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_2.sql
index 16eee08e..b4c873f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_3.sql
index 15836602..e5d4ae97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_event_trigger_full.sql
index 843cd230..4950ef5a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function.sql
index 7bd3f442..1dede625 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function_for_alter.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger.sql
index 2d7383c6..a794a288 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger_full.sql
index 5a7c7b5f..e74efbcc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_procedure.sql
index c6b64823..4156d93a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/11_plus/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_acl.sql
index 5c8b5c60..fbaab278 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_parameter.sql
index 48b1c3ee..e68ca8a3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_change_grantee_acl.sql
index 4317e3d0..53a6d190 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_comment.sql
index 5070ff43..585fd010 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_acl.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_parameter.sql
index f0b0878a..31a37a1d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_rename.sql
index 0ca7cb0a..5da77049 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_change_grantee_priv.sql
index 94af3546..e3ba35f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_comment.sql
index 86eae9ac..e29870f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_param.sql
index 4a8b0b17..d31596b1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_comment.sql
index 47a2376b..15673504 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_1.sql
index a753ef0d..1981336d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_2.sql
index 16eee08e..b4c873f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_3.sql
index 15836602..e5d4ae97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_event_trigger_full.sql
index a358edd1..f10c8cc5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function.sql
index 7bd3f442..1dede625 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function_for_alter.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger.sql
index 2d7383c6..a794a288 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger_full.sql
index 0b16c91c..b47c38bd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_procedure.sql
index c6b64823..4156d93a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/12_plus/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_acl.sql
index 9934b32c..a11c5210 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_parameter.sql
index d245db0f..7afd695a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_change_grantee_acl.sql
index 4bddbe36..0710dddd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_comment.sql
index 6cdd8d66..b38a5aef 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_acl.sql
index 8048c413..fd8f035b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_parameter.sql
index 3d645390..6790c128 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_rename.sql
index ecb75879..b86e9d55 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function.sql
index c741bde1..81c2f07f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function_for_alter.sql
index 8048c413..fd8f035b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.5_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_acl.sql
index 5c8b5c60..fbaab278 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_parameter.sql
index 48b1c3ee..e68ca8a3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_add_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_change_grantee_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_change_grantee_acl.sql
index 4317e3d0..53a6d190 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_change_grantee_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_change_grantee_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_comment.sql
index 5070ff43..585fd010 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_acl.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_acl.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_acl.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_parameter.sql
index f0b0878a..31a37a1d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_delete_parameter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_rename.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_rename.sql
index 0ca7cb0a..5da77049 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_rename.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_function_rename.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function3_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function3_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function3_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_change_grantee_priv.sql
index 94af3546..e3ba35f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_comment.sql
index 56267bda..3ba058ef 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_opt.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_opt.sql
index f71c6765..ebc52e2c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_opt.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_opt.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_param.sql
index d81298f0..ae0625ff 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_comment.sql
index 47a2376b..15673504 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_1.sql
index a753ef0d..1981336d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_2.sql
index 16eee08e..b4c873f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_3.sql
index 15836602..e5d4ae97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_event_trigger_full.sql
index 843cd230..4950ef5a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function.sql
index 7bd3f442..1dede625 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function1_$%{}[]()&*^!@"'`\/#(character varying)
 
--- DROP FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
+-- DROP FUNCTION IF EXISTS public."Function1_$%{}[]()&*^!@""'`\/#"(character varying);
 
 CREATE OR REPLACE FUNCTION public."Function1_$%{}[]()&*^!@""'`\/#"(
 	param character varying DEFAULT '1'::character varying)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function_for_alter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function_for_alter.sql
index f0a4af05..87c9237d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function_for_alter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_function_for_alter.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Function2_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Function2_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Function2_$%{}[]()&*^!@""'`\/#"(
 	)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger.sql
index 2d7383c6..a794a288 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger_full.sql
index a6e68805..d1bcf8b0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_procedure.sql
index ebc1b29f..dc807a76 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/9.6_plus/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_comment.sql
index 754559bd..c980abd4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_comment.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_opt.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_opt.sql
index 147ebbe0..c17e8f6e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_opt.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_opt.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_param.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_param.sql
index 6a6244b1..55986dda 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_param.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_proc_param.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_comment.sql
index 47a2376b..15673504 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_comment.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_1.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_1.sql
index a753ef0d..1981336d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_1.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_1.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_2.sql
index 16eee08e..b4c873f4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_2.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_2.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_3.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_3.sql
index 15836602..e5d4ae97 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_3.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/alter_ptrig_set_3.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_event_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_event_trigger_full.sql
index 843cd230..4950ef5a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_event_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_event_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF event_trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_plain_trigger_full.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_plain_trigger_full.sql
index 5a7c7b5f..e74efbcc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_plain_trigger_full.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_plain_trigger_full.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS SETOF trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_procedure.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_procedure.sql
index 9c4e1fcc..0ba60be8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_procedure.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/ppas/default/create_procedure.sql
@@ -1,6 +1,6 @@
 -- PROCEDURE: public.Proc1_$%{}[]()&*^!@"'`\/#(integer)
 
--- DROP PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
+-- DROP PROCEDURE IF EXISTS public."Proc1_$%{}[]()&*^!@""'`\/#"(integer);
 
 CREATE OR REPLACE PROCEDURE public."Proc1_$%{}[]()&*^!@""'`\/#"(
 	i1 integer)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
index f007a3ef..58f40c53 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py
@@ -616,7 +616,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
             status=200
         )
 
-    def get_SQL(self, gid, sid, did, data, scid, seid=None):
+    def get_SQL(self, gid, sid, did, data, scid, seid=None, if_exists=False):
         """
         This function will generate sql from model data.
 
@@ -666,7 +666,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
 
             sql = render_template(
                 "/".join([self.template_path, self._CREATE_SQL]),
-                data=data, conn=self.conn
+                data=data, conn=self.conn, if_exists=if_exists
             )
             sql += render_template(
                 "/".join([self.template_path, self._GRANT_SQL]),
@@ -739,7 +739,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
             result['schema'] = target_schema
 
         result = self._formatter(result, scid, seid)
-        sql, name = self.get_SQL(gid, sid, did, result, scid)
+        sql, name = self.get_SQL(gid, sid, did, result, scid, if_exists=True)
         # Most probably this is due to error
         if not isinstance(sql, str):
             return sql
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequences/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequences/sql/default/create.sql
index d05180b8..7080d94e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequences/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequences/sql/default/create.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS {{ conn|qtIdent(data.schema, data.name) }}{% if data.increment is defined and data.cycled %}
+CREATE SEQUENCE{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}{% if data.increment is defined and data.cycled %}
 
     CYCLE{% endif %}{% if data.increment is defined %}
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_negative_sequence_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_negative_sequence_msql.sql
index 0c343559..f62613c8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_negative_sequence_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_negative_sequence_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT -5
     START -30
     MINVALUE -40
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_msql.sql
index 429813b6..67e09cd6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT 5
     START 5
     MINVALUE 5
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_ownedby_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_ownedby_msql.sql
index d63bb958..1bd40fdf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_ownedby_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/pg/default/create_sequence_ownedby_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT 5
     START 5
     MINVALUE 5
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_negative_sequence_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_negative_sequence_msql.sql
index 8b693096..64e75266 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_negative_sequence_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_negative_sequence_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT -5
     START -30
     MINVALUE -40
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_msql.sql
index 9a209833..f926dbec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT 5
     START 5
     MINVALUE 5
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_ownedby_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_ownedby_msql.sql
index 722b0214..3cde9069 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_ownedby_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/tests/ppas/default/create_sequence_ownedby_msql.sql
@@ -1,4 +1,4 @@
-CREATE SEQUENCE IF NOT EXISTS public."Seq1_$%{}[]()&*^!@""'`\/#"
+CREATE SEQUENCE public."Seq1_$%{}[]()&*^!@""'`\/#"
     INCREMENT 5
     START 5
     MINVALUE 5
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index ad9ad330..4b70a95d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -1198,6 +1198,8 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
         json_resp = kwargs['json_resp'] if 'json_resp' in kwargs else True
         target_schema = kwargs['target_schema'] \
             if 'target_schema' in kwargs else None
+        if_exists_flag = kwargs['if_exists'] \
+            if 'if_exists' in kwargs else False
 
         if diff_data:
             return self._fetch_sql(did, scid, tid, diff_data, json_resp)
@@ -1227,7 +1229,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
 
             sql, partition_sql = BaseTableView.get_reverse_engineered_sql(
                 self, did=did, scid=scid, tid=tid, main_sql=main_sql,
-                data=data, json_resp=json_resp)
+                data=data, json_resp=json_resp, if_exists=if_exists_flag)
 
             return sql
 
@@ -1335,7 +1337,8 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
         data = res['rows'][0]
 
         return BaseTableView.get_reverse_engineered_sql(
-            self, did=did, scid=scid, tid=tid, main_sql=main_sql, data=data)
+            self, did=did, scid=scid, tid=tid, main_sql=main_sql, data=data,
+            if_exists=True)
 
     @BaseTableView.check_precondition
     def select_sql(self, gid, sid, did, scid, tid):
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
index 91deca0f..d10c1e25 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py
@@ -827,7 +827,9 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
 
         SQL = index_utils.get_reverse_engineered_sql(
             self.conn, schema=self.schema, table=self.table, did=did,
-            tid=tid, idx=idx, datlastsysoid=self.datlastsysoid)
+            tid=tid, idx=idx, datlastsysoid=self.datlastsysoid,
+            if_exists=True
+        )
 
         return ajax_response(response=SQL)
 
@@ -865,7 +867,9 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
                 self.conn, schema=target_schema,
                 table=self.table, did=did, tid=tid, idx=idx,
                 datlastsysoid=self.datlastsysoid,
-                template_path=None, with_header=False)
+                template_path=None, with_header=False,
+                if_exists=True
+            )
 
         drop_sql = ''
         if drop_req:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql
index 389593af..d232de21 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_first_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
+CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
     ON public.test_table_for_indexes USING btree
     (id ASC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS FIRST)
     WITH (FILLFACTOR=10)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last_msql.sql
index 8b294349..df340aae 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_asc_null_last_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
+CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
     ON public.test_table_for_indexes USING btree
     (id ASC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops ASC NULLS LAST)
     WITH (FILLFACTOR=10)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_first_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_first_msql.sql
index 652fa0a3..f7db5ea7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_first_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_first_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
+CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
     ON public.test_table_for_indexes USING btree
     (id DESC NULLS FIRST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS FIRST)
     TABLESPACE pg_default;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql
index 2e4096dd..9e23286a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_btree_desc_null_last_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNIQUE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
+CREATE UNIQUE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
     ON public.test_table_for_indexes USING btree
     (id DESC NULLS LAST, name COLLATE pg_catalog."POSIX" text_pattern_ops DESC NULLS LAST)
     WITH (FILLFACTOR=10)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_hash_index_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_hash_index_msql.sql
index c2d2b8e4..14f012b4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_hash_index_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/create_hash_index_msql.sql
@@ -1,4 +1,4 @@
-CREATE INDEX IF NOT EXISTS "Idx_$%{}[]()&*^!@""'`\/#"
+CREATE INDEX "Idx_$%{}[]()&*^!@""'`\/#"
     ON public.test_table_for_indexes USING hash
     (id)
     TABLESPACE pg_default;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/utils.py
index d8556f11..9bca4e3a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/utils.py
@@ -169,7 +169,8 @@ def get_include_details(conn, idx, data, template_path=None):
     return data
 
 
-def _get_create_sql(data, template_path, conn, mode, name):
+def _get_create_sql(data, template_path, conn, mode, name,
+                    if_exists_flag=False):
     """
     This function is used to get the sql where index is None
     :param data:
@@ -197,7 +198,8 @@ def _get_create_sql(data, template_path, conn, mode, name):
     # If the request for new object which do not have did
     sql = render_template(
         "/".join([template_path, 'create.sql']),
-        data=data, conn=conn, mode=mode
+        data=data, conn=conn, mode=mode,
+        if_exists=if_exists_flag
     )
     sql += "\n"
 
@@ -225,6 +227,7 @@ def get_sql(conn, **kwargs):
     datlastsysoid = kwargs.get('datlastsysoid')
     mode = kwargs.get('mode', None)
     template_path = kwargs.get('template_path', None)
+    if_exists_flag = kwargs.get('if_exists_flag', False)
 
     name = data['name'] if 'name' in data else None
     if idx is not None:
@@ -261,7 +264,8 @@ def get_sql(conn, **kwargs):
             data=data, o_data=old_data, conn=conn
         )
     else:
-        sql = _get_create_sql(data, template_path, conn, mode, name)
+        sql = _get_create_sql(data, template_path, conn, mode, name,
+                              if_exists_flag=if_exists_flag)
 
     return sql, name
 
@@ -283,6 +287,7 @@ def get_reverse_engineered_sql(conn, **kwargs):
     datlastsysoid = kwargs.get('datlastsysoid')
     template_path = kwargs.get('template_path', None)
     with_header = kwargs.get('with_header', True)
+    if_exists_flag = kwargs.get('if_exists', False)
 
     SQL = render_template("/".join([template_path, 'properties.sql']),
                           did=did, tid=tid, idx=idx,
@@ -308,7 +313,8 @@ def get_reverse_engineered_sql(conn, **kwargs):
         data = get_include_details(conn, idx, data)
 
     SQL, name = get_sql(conn, data=data, did=did, tid=tid, idx=None,
-                        datlastsysoid=datlastsysoid)
+                        datlastsysoid=datlastsysoid,
+                        if_exists_flag=if_exists_flag)
 
     if with_header:
         sql_header = "-- Index: {0}\n\n-- ".format(data['name'])
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition.sql
index 35bf35bb..61ded107 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition.sql
@@ -19,7 +19,7 @@ COMMENT ON TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
     FOR VALUES FROM ('0') TO ('1000');
 
 ALTER TABLE IF EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition_msql.sql
index 4338f605..30c1610f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/alter_table_add_partition_msql.sql
@@ -1,2 +1,2 @@
-CREATE TABLE IF NOT EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
     FOR VALUES FROM (0) TO (1000);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/create_table_with_partition_msql.sql
index 47801b79..7dab015e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/10_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 (
     m_col bigint
 ) PARTITION BY RANGE (m_col)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition.sql
index 2a8fd6d3..65e4c04f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition.sql
@@ -15,7 +15,7 @@ COMMENT ON TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
     FOR VALUES FROM ('0') TO ('1000');
 
 ALTER TABLE IF EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition_msql.sql
index 4338f605..30c1610f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/alter_table_add_partition_msql.sql
@@ -1,2 +1,2 @@
-CREATE TABLE IF NOT EXISTS public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_part_$%{}[]()&*^!@""""""""'`\/#" PARTITION OF public."test_table_$%{}[]()&*^!@""""'`\/#"
     FOR VALUES FROM (0) TO (1000);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/create_table_with_partition_msql.sql
index 48383df4..751d2ec2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/pg/12_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 (
     m_col bigint
 ) PARTITION BY RANGE (m_col);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/10_plus/create_table_with_partition_msql.sql
index e5629763..bdd5fcf9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/10_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/10_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 (
     m_col bigint
 ) PARTITION BY RANGE (m_col)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/12_plus/create_table_with_partition_msql.sql
index bb61b515..0e7a4906 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/12_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/tests/ppas/12_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."test_table_$%{}[]()&*^!@""""'`\/#"
+CREATE TABLE public."test_table_$%{}[]()&*^!@""""'`\/#"
 (
     m_col bigint
 ) PARTITION BY RANGE (m_col);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_delete_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_delete_event_rule.sql
index 3623b2e6..89cc7605 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_delete_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_delete_event_rule.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_delete_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_delete_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_delete_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON DELETE TO public.test_emp_rule
     DO INSTEAD
 (DELETE FROM test_emp_rule
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule.sql
index 009fa66e..e45f7401 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_insert_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON INSERT TO public.test_emp_rule
     WHERE (new.salary > 8000)
     DO INSTEAD
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_complex.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_complex.sql
index b755bff8..86ebeadf 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_complex.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_complex.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_insert_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON INSERT TO public.test_emp_rule
     WHERE (new.salary > 8000)
     DO INSTEAD
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing.sql
index 5736790e..406038f1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_insert_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON INSERT TO public.test_emp_rule
     WHERE (new.salary > 8000)
     DO INSTEAD NOTHING;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing_update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing_update.sql
index 9bec3d21..577a1081 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing_update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_insert_event_rule_nothing_update.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_insert_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON UPDATE TO public.test_emp_rule
     WHERE (new.salary > 8000)
     DO INSTEAD NOTHING;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_update_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_update_event_rule.sql
index 26ec0501..865b750d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_update_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/alter_update_event_rule.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_update_rule1_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_update_rule1_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_update_rule1_$%{}[]()&*^!@""'`\/#" AS
     ON UPDATE TO public.test_emp_rule
     WHERE (old.name = 'Sam'::text)
     DO INSTEAD
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule.sql
index 86f90b51..aaf98d6c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule.sql
@@ -2,6 +2,6 @@
 
 -- DROP Rule "test_delete_rule_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_delete_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_delete_rule_$%{}[]()&*^!@""'`\/#" AS
     ON DELETE TO public.test_emp_rule
     DO NOTHING;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule_msql.sql
index dd7f714f..d3e7c2c0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_delete_event_rule_msql.sql
@@ -1,3 +1,3 @@
-CREATE OR REPLACE RULE "test_delete_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_delete_rule_$%{}[]()&*^!@""'`\/#" AS
     ON DELETE TO public.test_emp_rule
     DO NOTHING;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule.sql
index 15d4809b..e28f3963 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_insert_rule_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_insert_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule_$%{}[]()&*^!@""'`\/#" AS
     ON INSERT TO public.test_emp_rule
     WHERE (new.salary > 5000)
     DO
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule_msql.sql
index 6db189d9..a2ea3fce 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_insert_event_rule_msql.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE RULE "test_insert_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_insert_rule_$%{}[]()&*^!@""'`\/#" AS
     ON INSERT TO public.test_emp_rule
     WHERE (new.salary > 5000)
     DO
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule.sql
index 59f16cd1..39748c63 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule.sql
@@ -2,7 +2,7 @@
 
 -- DROP Rule "test_update_rule_$%{}[]()&*^!@""'`\/#" ON public.test_emp_rule;
 
-CREATE OR REPLACE RULE "test_update_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_update_rule_$%{}[]()&*^!@""'`\/#" AS
     ON UPDATE TO public.test_emp_rule
     WHERE (old.name = 'Joe'::text)
     DO
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule_msql.sql
index b07abf8d..f817f274 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/create_update_event_rule_msql.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE RULE "test_update_rule_$%{}[]()&*^!@""'`\/#" AS
+CREATE RULE "test_update_rule_$%{}[]()&*^!@""'`\/#" AS
     ON UPDATE TO public.test_emp_rule
     WHERE (old.name = 'Joe')
     DO
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql
index 98ac72be..837960f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/11_plus/create.sql
@@ -1,4 +1,4 @@
-CREATE {% if data.indisunique %}UNIQUE {% endif %}INDEX IF NOT EXISTS {% if data.isconcurrent %}CONCURRENTLY {% endif %}{{conn|qtIdent(data.name)}}
+CREATE {% if data.indisunique %}UNIQUE {% endif %}INDEX{% if if_exists %} IF NOT EXISTS{% endif %} {% if data.isconcurrent %}CONCURRENTLY {% endif %}{{conn|qtIdent(data.name)}}
     ON {{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %}
 
 {% if mode == 'create' %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/create.sql
index 9952aa5f..6b1c74ee 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/indexes/sql/default/create.sql
@@ -1,4 +1,4 @@
-CREATE {% if data.indisunique %}UNIQUE {% endif %}INDEX IF NOT EXISTS {% if data.isconcurrent %}CONCURRENTLY {% endif %}{{conn|qtIdent(data.name)}}
+CREATE {% if data.indisunique %}UNIQUE {% endif %}INDEX{% if if_exists %} IF NOT EXISTS{% endif %} {% if data.isconcurrent %}CONCURRENTLY {% endif %}{{conn|qtIdent(data.name)}}
     ON {{conn|qtIdent(data.schema, data.table)}} {% if data.amname %}USING {{conn|qtIdent(data.amname)}}{% endif %}
 
 {% if mode == 'create' %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partitions/sql/pg/10_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partitions/sql/pg/10_plus/create.sql
index d68c955e..7440bef8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partitions/sql/pg/10_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/partitions/sql/pg/10_plus/create.sql
@@ -4,7 +4,7 @@
 {#===========================================#}
 {### CREATE TABLE STATEMENT FOR partitions ###}
 
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{% if data.relispartition is defined and data.relispartition %} PARTITION OF {{conn|qtIdent(data.parent_schema, data.partitioned_table_name)}}{% endif %}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{% if data.relispartition is defined and data.relispartition %} PARTITION OF {{conn|qtIdent(data.parent_schema, data.partitioned_table_name)}}{% endif %}
 
 {# Macro to render for constraints #}
 {% if data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/rules/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/rules/sql/create.sql
index d78a0d0d..7c41c0a8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/rules/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/rules/sql/create.sql
@@ -6,7 +6,7 @@
 
 {% endif %}
 {% if data.name and data.schema and data.view %}
-CREATE OR REPLACE RULE {{ conn|qtIdent(data.name) }} AS
+CREATE{% if if_replace %} OR REPLACE{% endif %} RULE {{ conn|qtIdent(data.name) }} AS
     ON {{ data.event|upper if data.event else 'SELECT' }} TO {{ conn|qtIdent(data.schema, data.view) }}
 {% if data.condition %}
     WHERE ({{ data.condition }})
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/create.sql
index 43d0dedd..e3b3a7d9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/create.sql
@@ -16,7 +16,7 @@
 {% if data.coll_inherits|length == 0 and  data.columns|length == 0 and not data.typname and not data.like_relation and data.primary_key|length == 0 and data.unique_constraint|length == 0 and data.foreign_key|length == 0 and data.check_constraint|length == 0 and data.exclude_constraint|length == 0 %}
 {% set empty_bracket = "\n(\n)"%}
 {% endif %}
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
 {% if data.typname %}
     OF {{ data.typname }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
index 2c900faf..cc6326e9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/11_plus/create.sql
@@ -16,7 +16,7 @@
 {% if data.coll_inherits|length == 0 and  data.columns|length == 0 and not data.typname and not data.like_relation and data.primary_key|length == 0 and data.unique_constraint|length == 0 and data.foreign_key|length == 0 and data.check_constraint|length == 0 and data.exclude_constraint|length == 0 %}
 {% set empty_bracket = "\n(\n)"%}
 {% endif %}
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
 {% if data.typname %}
     OF {{ data.typname }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
index 71cd26ee..8fa904c6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/12_plus/create.sql
@@ -20,7 +20,7 @@
 {% if data.fillfactor or data.parallel_workers or data.toast_tuple_target or data.autovacuum_custom or data.autovacuum_enabled in ('t', 'f') or data.toast_autovacuum or data.toast_autovacuum_enabled in ('t', 'f') %}
 {% set with_clause = true%}
 {% endif %}
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
 {% if data.typname %}
     OF {{ data.typname }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.6_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.6_plus/create.sql
index b88b92bc..96342acb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.6_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.6_plus/create.sql
@@ -16,7 +16,7 @@
 {% if data.coll_inherits|length == 0 and  data.columns|length == 0 and not data.typname and not data.like_relation and data.primary_key|length == 0 and data.unique_constraint|length == 0 and data.foreign_key|length == 0 and data.check_constraint|length == 0 and data.exclude_constraint|length == 0 %}
 {% set empty_bracket = "\n(\n)"%}
 {% endif %}
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
 {% if data.typname %}
     OF {{ data.typname }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
index 5a7dc4eb..9e9c8a21 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/default/create.sql
@@ -16,7 +16,7 @@
 {% if data.coll_inherits|length == 0 and  data.columns|length == 0 and not data.typname and not data.like_relation and data.primary_key|length == 0 and data.unique_constraint|length == 0 and data.foreign_key|length == 0 and data.check_constraint|length == 0 and data.exclude_constraint|length == 0 %}
 {% set empty_bracket = "\n(\n)"%}
 {% endif %}
-CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE IF NOT EXISTS {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
+CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE{% if if_exists %} IF NOT EXISTS{% endif %} {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
 {% if data.typname %}
     OF {{ data.typname }}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate.sql
index 20815da3..08b34851 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate.sql
@@ -21,7 +21,7 @@ COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
 ALTER TABLE IF EXISTS public.cust_arr_small
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate_msql.sql
index 2de617d6..12b54c5e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -14,6 +14,6 @@ ALTER TABLE IF EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     IS 'partition table';
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql
index 3821f29e..5c689223 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql
@@ -21,7 +21,7 @@ COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES IN ('ACTIVE');
 
 ALTER TABLE IF EXISTS public.cust_active
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql
index fec9679b..79826cea 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -14,5 +14,5 @@ ALTER TABLE IF EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     IS 'partition table';
 
-CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES IN ('ACTIVE');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql
index 142e1abc..1dc9a50e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql
@@ -18,7 +18,7 @@ ALTER TABLE IF EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
 ALTER TABLE IF EXISTS public."cust_arr_small PARTITION"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql
index ea340086..6ab1e855 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -11,5 +11,5 @@ WITH (
 ALTER TABLE IF EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     OWNER to postgres;
 
-CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM (20) TO (25);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql
index 20815da3..08b34851 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate.sql
@@ -21,7 +21,7 @@ COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
 ALTER TABLE IF EXISTS public.cust_arr_small
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate_msql.sql
index 2de617d6..12b54c5e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -14,6 +14,6 @@ ALTER TABLE IF EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     IS 'partition table';
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql
index 4e4cfa13..59405123 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql
@@ -21,7 +21,7 @@ COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     FOR VALUES WITH (modulus 2, remainder 1);
 
 ALTER TABLE IF EXISTS public.cust_part11
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql
index 49cdb5bf..09538ed9 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 (
     id bigint,
     name text,
@@ -14,5 +14,5 @@ ALTER TABLE IF EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     IS 'hash partition';
 
-CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     FOR VALUES WITH (MODULUS 2, REMAINDER 1);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql
index 5401aa23..dfadf3bb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate.sql
@@ -17,7 +17,7 @@ COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
 ALTER TABLE IF EXISTS public.cust_arr_small
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate_msql.sql
index 55f9b7cd..a9b93c36 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -11,6 +11,6 @@ ALTER TABLE IF EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 COMMENT ON TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     IS 'partition table';
 
-CREATE TABLE IF NOT EXISTS public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_arr_small PARTITION OF public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql
index 8fcea6a4..6ea6d942 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
+CREATE UNLOGGED TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
 (
     col1 double precision,
     col2 numrange
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql
index f56f3d10..5afb6094 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
 (
     col1 character varying(10)[],
     col2 date
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql
index f5d3268e..5c1161e5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 bigint,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql
index 58b20721..8e83b860 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql
@@ -17,7 +17,7 @@ COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     FOR VALUES WITH (modulus 2, remainder 1);
 
 ALTER TABLE IF EXISTS public.cust_part11
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql
index 7aecb081..9a9351da 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 (
     id bigint,
     name text,
@@ -11,5 +11,5 @@ ALTER TABLE IF EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     IS 'hash partition';
 
-CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
     FOR VALUES WITH (MODULUS 2, REMAINDER 1);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql
index 484a0d0e..2218a168 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"
 (
     LIKE public.like_tbl
         INCLUDING DEFAULTS
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql
index d0b0cf38..06710591 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql
@@ -17,7 +17,7 @@ COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES IN ('ACTIVE');
 
 ALTER TABLE IF EXISTS public.cust_active
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql
index 0371c6d1..62b27664 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -11,5 +11,5 @@ ALTER TABLE IF EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     IS 'partition table';
 
-CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES IN ('ACTIVE');
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql
index 8abf24d4..a5399ac1 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone,
     col2 character(12),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql
index 71bc769d..0330073f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" integer,
     "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql
index 82ed6da2..3aa2d990 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql
@@ -14,7 +14,7 @@ ALTER TABLE IF EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 
 -- Partitions SQL
 
-CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM ('20') TO ('25');
 
 ALTER TABLE IF EXISTS public."cust_arr_small PARTITION"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql
index 77ae9a4a..dd0c233e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
@@ -8,5 +8,5 @@ CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/
 ALTER TABLE IF EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     OWNER to postgres;
 
-CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
     FOR VALUES FROM (20) TO (25);
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql
index 9cd042d6..da9e9be7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql
index 295227c2..ee9793e4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
+CREATE UNLOGGED TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
 (
     col1 double precision,
     col2 numrange
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql
index f6f6f313..e0bf5bd7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
 (
     col1 character varying(10)[],
     col2 date
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql
index 604d4e56..fb9536f3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 bigint,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql
index 1d293587..7bac199e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"
 (
     LIKE public.like_tbl
         INCLUDING DEFAULTS
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql
index 3a333983..9fbdcb4d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone,
     col2 character(12),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql
index ef345d65..216b2915 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" integer,
     "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql
index ec698c8b..8faaef59 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_partition_table_with_collate_msql.sql
index 67eb01fb..ab5432a0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql
index 7b2b7445..5c987202 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql
index c44bb024..015bb192 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_partition_table_with_collate_msql.sql
index 67eb01fb..ab5432a0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql
index a9486b2c..33e8c8fd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 (
     id bigint,
     name text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_partition_table_with_collate_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_partition_table_with_collate_msql.sql
index aa10397b..5177e8b5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_partition_table_with_collate_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_partition_table_with_collate_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."partition_table_with_collate_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql
index 4f196ce7..b60ddc41 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
+CREATE UNLOGGED TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
 (
     col1 double precision,
     col2 numrange
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql
index bddb655b..fafbf377 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
 (
     col1 character varying(10)[],
     col2 date
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql
index b0191f0a..ad2f2364 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 bigint,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql
index a33b3305..24db68e3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
+CREATE TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"
 (
     id bigint,
     name text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql
index 1d41ebb2..d85d0d3c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"
 (
     LIKE public.like_tbl
         INCLUDING DEFAULTS
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql
index 5bd3de2e..a5843c6a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql
index 661a97a6..fe051f7d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone,
     col2 character(12),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql
index 7a599072..51919224 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" integer,
     "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql
index db2aac1b..bdf65e56 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"
 (
     id integer,
     status text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql
index 3551842c..d4d2cb49 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql
index df7cd7b2..17cbb143 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
+CREATE UNLOGGED TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"
 (
     col1 double precision,
     col2 numrange
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql
index 6041f756..59e3d84b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"
 (
     col1 character varying(10)[],
     col2 date
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql
index 8d8eda04..cb2714cc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 bigint,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql
index cf6bfc80..38f2d914 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"
 (
     LIKE public.like_tbl
         INCLUDING DEFAULTS
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql
index dbe94cca..9303172e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone,
     col2 character(12),
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql
index 6de40666..39d8581c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"
 (
     "col1_$%{}[]()&*^!@\""'`\\/#" integer,
     "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql
index 91c5cc7c..d763298c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql
@@ -1,4 +1,4 @@
-CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#"
+CREATE TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"
 (
     col1 integer,
     col2 text,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql
index 435237a0..759c632e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql
index 2d7383c6..a794a288 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql
@@ -1,6 +1,6 @@
 -- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#()
 
--- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"();
+-- DROP FUNCTION IF EXISTS public."Trig1_$%{}[]()&*^!@""'`\/#"();
 
 CREATE OR REPLACE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"()
     RETURNS trigger
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
index 8316a0be..d129b984 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/utils.py
@@ -666,7 +666,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
                     c['cltype'], c['hasSqrBracket'] = \
                         column_utils.type_formatter(c['cltype'])
 
-    def _get_resql_for_table(self, did, scid, tid, data, json_resp, main_sql):
+    def _get_resql_for_table(self, did, scid, tid, data, json_resp, main_sql,
+                             if_exists=False):
         """
         #####################################
         # Reverse engineered sql for TABLE
@@ -705,18 +706,20 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
         if 'relispartition' in data and data['relispartition']:
             table_sql = render_template("/".join([self.partition_template_path,
                                                   self._CREATE_SQL]),
-                                        data=data, conn=self.conn)
+                                        data=data, conn=self.conn,
+                                        if_exists=if_exists)
         else:
             table_sql = render_template("/".join([self.table_template_path,
                                                   self._CREATE_SQL]),
-                                        data=data, conn=self.conn, is_sql=True)
+                                        data=data, conn=self.conn, is_sql=True,
+                                        if_exists=if_exists)
 
         # Add into main sql
         table_sql = re.sub(self.pattern, self.double_newline, table_sql)
         main_sql.append(table_sql.strip('\n'))
 
     def _get_resql_for_index(self, did, tid, main_sql, json_resp, schema,
-                             table):
+                             table, if_exists=False):
         """
         ######################################
         # Reverse engineered sql for INDEX
@@ -742,7 +745,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
             index_sql = index_utils.get_reverse_engineered_sql(
                 self.conn, schema=schema, table=table, did=did, tid=tid,
                 idx=row['oid'], datlastsysoid=self.datlastsysoid,
-                template_path=None, with_header=json_resp)
+                template_path=None, with_header=json_resp, if_exists=if_exists
+            )
             index_sql = "\n" + index_sql
 
             # Add into main sql
@@ -871,7 +875,9 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
 
             rules_sql += render_template("/".join(
                 [self.rules_template_path, self._CREATE_SQL]),
-                data=res_data, display_comments=display_comments)
+                data=res_data, display_comments=display_comments,
+                if_replace=True
+            )
 
             # Add into main sql
             rules_sql = re.sub(self.pattern, self.double_newline, rules_sql)
@@ -1021,6 +1027,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
         data = kwargs.get('data')
         json_resp = kwargs.get('json_resp', True)
         diff_partition_sql = kwargs.get('diff_partition_sql', False)
+        if_exists_flag = kwargs.get('if_exists', False)
 
         # Table & Schema declaration so that we can use them in child nodes
         schema = data['schema']
@@ -1028,10 +1035,11 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
         is_partitioned = 'is_partitioned' in data and data['is_partitioned']
 
         # Get Reverse engineered sql for Table
-        self._get_resql_for_table(did, scid, tid, data, json_resp, main_sql)
+        self._get_resql_for_table(did, scid, tid, data, json_resp, main_sql,
+                                  if_exists=if_exists_flag)
         # Get Reverse engineered sql for Table
         self._get_resql_for_index(did, tid, main_sql, json_resp, schema,
-                                  table)
+                                  table, if_exists=if_exists_flag)
 
         # Get Reverse engineered sql for ROW SECURITY POLICY
         self._get_resql_for_row_security_policy(scid, tid, json_resp,
@@ -1435,7 +1443,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
         if 'relacl' in data:
             data['relacl'] = parse_priv_to_db(data['relacl'], self.acl)
 
-    def get_sql(self, did, scid, tid, data, res):
+    def get_sql(self, did, scid, tid, data, res, if_exists=False):
         """
         This function will generate create/update sql from model data
         coming from client
@@ -1534,7 +1542,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
 
             sql = render_template("/".join([self.table_template_path,
                                             self._CREATE_SQL]),
-                                  data=data, conn=self.conn)
+                                  data=data, conn=self.conn,
+                                  if_exists=if_exists)
 
             # Append SQL for partitions
             sql += '\n' + partitions_sql
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/create.sql
index 12dd1025..a43b359b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/pg/9.2_plus/sql/create.sql
@@ -1,6 +1,6 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% if data %}
-CREATE SCHEMA {{ conn|qtIdent(data.name) }}
+CREATE SCHEMA{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.name) }}
 {% if data.namespaceowner %}
     AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
 
@@ -14,4 +14,4 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
 {% for priv in data.nspacl %}
 {{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
 {% endif %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/create.sql
index 2016209b..c8b52ba5 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/create.sql
@@ -2,7 +2,7 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
 {% if data.name %}
-CREATE SCHEMA {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
+CREATE SCHEMA{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
 
     AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }}{% endif %}{% endif %};
 {#  Alter the comment/description #}
@@ -37,4 +37,4 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
 
 {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
 {% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/delete.sql
index 74e9126d..75e9a8b4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/9.2_plus/sql/delete.sql
@@ -1 +1 @@
-DROP SCHEMA {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
+DROP SCHEMA IF EXISTS {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/create.sql
index 4a071c4b..e28303ec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/create.sql
@@ -2,7 +2,7 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
 {% if data.name %}
-CREATE SCHEMA {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
+CREATE SCHEMA{% if if_exists %} IF NOT EXISTS {% endif %} {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
 
     AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }}{% endif %}{% endif %};
 {#  Alter the comment/description #}
@@ -37,4 +37,4 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
 
 {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
 {% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/delete.sql
index 74e9126d..75e9a8b4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/pg/default/sql/delete.sql
@@ -1 +1 @@
-DROP SCHEMA {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
+DROP SCHEMA IF EXISTS {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/create.sql
index 4a071c4b..e28303ec 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/create.sql
@@ -2,7 +2,7 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
 {% if data.name %}
-CREATE SCHEMA {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
+CREATE SCHEMA{% if if_exists %} IF NOT EXISTS {% endif %} {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
 
     AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }}{% endif %}{% endif %};
 {#  Alter the comment/description #}
@@ -37,4 +37,4 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
 
 {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
 {% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/delete.sql
index 74e9126d..75e9a8b4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.1_plus/sql/delete.sql
@@ -1 +1 @@
-DROP SCHEMA {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
+DROP SCHEMA IF EXISTS {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/create.sql
index 2016209b..7f3ec587 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/create.sql
@@ -2,7 +2,7 @@
 {% import 'macros/privilege.macros' as PRIVILEGE %}
 {% import 'macros/default_privilege.macros' as DEFAULT_PRIVILEGE %}
 {% if data.name %}
-CREATE SCHEMA {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
+CREATE SCHEMA IF NOT EXISTS {{ conn|qtIdent(data.name) }}{% if data.namespaceowner %}
 
     AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }}{% endif %}{% endif %};
 {#  Alter the comment/description #}
@@ -37,4 +37,4 @@ COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
 
 {{ SECLABEL.APPLY(conn, 'SCHEMA', data.name, r.provider, r.label) }}
 {% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/delete.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/delete.sql
index 74e9126d..75e9a8b4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schemas/ppas/9.2_plus/sql/delete.sql
@@ -1 +1 @@
-DROP SCHEMA {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
+DROP SCHEMA IF EXISTS {{ conn|qtIdent(name) }} {% if cascade %}CASCADE{%endif%};
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_add_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_add_priv.sql
index e90ef0f7..82ad3b78 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_add_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_add_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 GRANT CREATE ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_drop_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_drop_priv.sql
index e42962c2..1cc63866 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_drop_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_drop_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 GRANT ALL ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO postgres;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_name.sql
index 86bf07af..3642167e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_name.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema1_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema1_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema1_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 COMMENT ON SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_update_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_update_priv.sql
index c8fc71a7..5b58e2c6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_update_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/alter_schema_update_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 GRANT USAGE ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_all_options.sql
index 9251fbe0..83612440 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_all_options.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_with_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_with_comment.sql
index 83973a3a..e0e4cf4c 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_with_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/pg/9.2_plus/create_schema_with_comment.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION postgres;
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_add_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_add_priv.sql
index 8b130b32..bd5e39ff 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_add_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_add_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 GRANT CREATE ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_drop_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_drop_priv.sql
index a18430f2..f74bbabd 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_drop_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_drop_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 GRANT ALL ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO enterprisedb;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_name.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_name.sql
index 5ef0e452..3b195c25 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_name.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema1_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema1_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema1_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 COMMENT ON SCHEMA "test_schema1_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_update_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_update_priv.sql
index e200bff3..33060693 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_update_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/alter_schema_update_priv.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 GRANT USAGE ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" TO PUBLIC;
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options.sql
index 5b92773e..bb7da31f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options_msql.sql
index 2c80b514..d03bb981 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_all_options_msql.sql
@@ -1,4 +1,4 @@
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#";
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#";
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
     IS 'This is a test comment';
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment.sql
index c8a8a15b..bc7dcd5a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment.sql
@@ -1,8 +1,8 @@
 -- SCHEMA: test_schema_$%{}[]()&*^!@""'`\/#
 
--- DROP SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#" ;
+-- DROP SCHEMA IF EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#" ;
 
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#"
     AUTHORIZATION enterprisedb;
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment_msql.sql
index add17f78..ce2bbc2a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tests/ppas/9.2_plus/create_schema_with_comment_msql.sql
@@ -1,4 +1,4 @@
-CREATE SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#";
+CREATE SCHEMA IF NOT EXISTS "test_schema_$%{}[]()&*^!@""""'`\/#";
 
 COMMENT ON SCHEMA "test_schema_$%{}[]()&*^!@""""'`\/#"
     IS 'This is a test comment';
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index ed9245f3..379b2ceb 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -1371,7 +1371,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
         SQL = render_template("/".join(
             [self.template_path, self._SQL_PREFIX + self._PROPERTIES_SQL]),
             vid=vid,
-            datlastsysoid=self.datlastsysoid
+            datlastsysoid=self.datlastsysoid,
         )
 
         status, res = self.conn.execute_dict(SQL)
@@ -1427,7 +1427,8 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
             [self.template_path, self._SQL_PREFIX + self._CREATE_SQL]),
             data=result,
             conn=self.conn,
-            display_comments=display_comments
+            display_comments=display_comments,
+            if_replace=True
         )
         SQL += "\n"
         SQL += render_template("/".join(
@@ -1983,7 +1984,8 @@ class MViewNode(ViewNode, VacuumSettings):
             [self.template_path, self._SQL_PREFIX + self._CREATE_SQL]),
             data=result,
             conn=self.conn,
-            display_comments=display_comments
+            display_comments=display_comments,
+            if_exists=True
         )
         SQL += "\n"
         SQL += render_template("/".join(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/create.sql
index 3aa46653..835faa84 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/create.sql
@@ -6,7 +6,7 @@
 
 {% endif %}
 {% if data.name and data.schema and data.definition %}
-CREATE MATERIALIZED VIEW IF NOT EXISTS {{ conn|qtIdent(data.schema, data.name) }}
+CREATE MATERIALIZED VIEW{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
 {% if(data.fillfactor or data.autovacuum_enabled in ('t', 'f') or data.toast_autovacuum_enabled in ('t', 'f') or data['vacuum_data']|length > 0) %}
 {% set ns = namespace(add_comma=false) %}
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/create.sql
index 3aa46653..3cfa7e32 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/create.sql
@@ -2,11 +2,11 @@
 {% if display_comments %}
 -- View: {{ data.schema }}.{{ data.name }}
 
--- DROP MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }};
+-- DROP MATERIALIZED VIEW IF EXISTS {{ conn|qtIdent(data.schema, data.name) }};
 
 {% endif %}
 {% if data.name and data.schema and data.definition %}
-CREATE MATERIALIZED VIEW IF NOT EXISTS {{ conn|qtIdent(data.schema, data.name) }}
+CREATE MATERIALIZED VIEW{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
 {% if(data.fillfactor or data.autovacuum_enabled in ('t', 'f') or data.toast_autovacuum_enabled in ('t', 'f') or data['vacuum_data']|length > 0) %}
 {% set ns = namespace(add_comma=false) %}
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/ppas/9.3_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/ppas/9.3_plus/sql/create.sql
index 3aa46653..835faa84 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/ppas/9.3_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/ppas/9.3_plus/sql/create.sql
@@ -6,7 +6,7 @@
 
 {% endif %}
 {% if data.name and data.schema and data.definition %}
-CREATE MATERIALIZED VIEW IF NOT EXISTS {{ conn|qtIdent(data.schema, data.name) }}
+CREATE MATERIALIZED VIEW{% if if_exists %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.schema, data.name) }}
 {% if(data.fillfactor or data.autovacuum_enabled in ('t', 'f') or data.toast_autovacuum_enabled in ('t', 'f') or data['vacuum_data']|length > 0) %}
 {% set ns = namespace(add_comma=false) %}
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/create.sql
index ba3c810b..6b12bc8e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/create.sql
@@ -6,7 +6,7 @@
 
 {% endif %}
 {% if data.name and data.schema and data.definition %}
-CREATE OR REPLACE VIEW {{ conn|qtIdent(data.schema, data.name) }}
+CREATE{% if if_replace %} OR REPLACE{% endif %} VIEW {{ conn|qtIdent(data.schema, data.name) }}
 {% if ((data.check_option and data.check_option.lower() != 'no') or data.security_barrier) %}
 WITH ({% if data.check_option and data.check_option.lower() != 'no' %}
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/ppas/9.4_plus/sql/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/ppas/9.4_plus/sql/create.sql
index d0521050..d23f2a13 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/ppas/9.4_plus/sql/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/ppas/9.4_plus/sql/create.sql
@@ -6,7 +6,7 @@
 
 {% endif %}
 {% if data.name and data.schema and data.definition %}
-CREATE OR REPLACE VIEW {{ conn|qtIdent(data.schema, data.name) }}
+CREATE{% if if_replace %} OR REPLACE{% endif %} VIEW {{ conn|qtIdent(data.schema, data.name) }}
 {% if ((data.check_option and data.check_option.lower() != 'no') or data.security_barrier) %}
 WITH ({% if data.check_option and data.check_option.lower() != 'no' %}
 
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview.sql
index c53b0970..fe6e1a8d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_fillfactor.sql
index 49b2625d..74c71465 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_fillfactor.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_fillfactor.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_table_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_table_parameter.sql
index a05ab8df..252ca002 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_table_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_add_table_parameter.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_change_grantee_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_change_grantee_priv.sql
index fcd7b144..973ed0de 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_change_grantee_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_change_grantee_priv.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_definition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_definition.sql
index 1caca831..43c20641 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_definition.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_definition.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_drop_all_priv.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_drop_all_priv.sql
index 949fe0cd..1fb2031e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_drop_all_priv.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_drop_all_priv.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_remove_table_parameter.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_remove_table_parameter.sql
index 49b2625d..74c71465 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_remove_table_parameter.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/alter_mview_remove_table_parameter.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 WITH (
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview.sql
index 7541f284..08746274 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview.sql
@@ -1,6 +1,6 @@
 -- View: public.testmview_$%{}[]()&*^!/@`#
 
--- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
+-- DROP MATERIALIZED VIEW IF EXISTS public."testmview_$%{}[]()&*^!/@`#";
 
 CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview_msql.sql
index 0f49fa60..cacc129a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_mview_msql.sql
@@ -1,4 +1,4 @@
-CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
+CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
 AS
 SELECT 1
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_view_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_view_msql.sql
index a5c129a0..027b1b15 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_view_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/pg/9.4_plus/create_view_msql.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
+CREATE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
 WITH (
   check_option=local
 ) AS
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_mview_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_mview_msql.sql
index 36b1dbc2..f02deb13 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_mview_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_mview_msql.sql
@@ -1,4 +1,4 @@
-CREATE MATERIALIZED VIEW IF NOT EXISTS public."testmview_$%{}[]()&*^!/@`#"
+CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
 TABLESPACE pg_default
 AS
 SELECT 1
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_view_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_view_msql.sql
index 831b3b5a..9b074cba 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_view_msql.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/ppas/9.4_plus/create_view_msql.sql
@@ -1,4 +1,4 @@
-CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
+CREATE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
 WITH (
   check_option=local
 ) AS
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/create.sql
index cf2eada9..5c2bbbff 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/create.sql
@@ -1,10 +1,10 @@
 {% if display_comments %}
 -- RESOURCE GROUP: {{rgname}}
 
--- DROP RESOURCE GROUP {{ conn|qtIdent(rgname) }}
+-- DROP RESOURCE GROUP IF EXISTS {{ conn|qtIdent(rgname) }}
 
 {% endif %}
 {# ============= Create the resource group============= #}
 {% if rgname %}
 CREATE RESOURCE GROUP {{ conn|qtIdent(rgname) }};
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/delete.sql b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/delete.sql
index 1c9bda7b..ee9a38d4 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/delete.sql
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/sql/default/delete.sql
@@ -4,5 +4,5 @@ SELECT rgrpname FROM edb_resource_group WHERE oid = {{rgid}}::oid;
 {% endif %}
 {# ============= Below SQL will drop the resource group ============= #}
 {% if rgname %}
-DROP RESOURCE GROUP {{ conn|qtIdent(rgname) }};
-{% endif %}
\ No newline at end of file
+DROP RESOURCE GROUP IF EXISTS {{ conn|qtIdent(rgname) }};
+{% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_name.sql b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_name.sql
index 2a053a53..df5ecc1c 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_name.sql
@@ -1,6 +1,6 @@
 -- RESOURCE GROUP: Rg2_$%{}[]()&*^!@"'`\/#
 
--- DROP RESOURCE GROUP "Rg2_$%{}[]()&*^!@""'`\/#"
+-- DROP RESOURCE GROUP IF EXISTS "Rg2_$%{}[]()&*^!@""'`\/#"
 
 CREATE RESOURCE GROUP "Rg2_$%{}[]()&*^!@""'`\/#";
 
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_options.sql b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_options.sql
index d64aea6a..57147139 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/alter_resource_group_options.sql
@@ -1,6 +1,6 @@
 -- RESOURCE GROUP: Rg2_$%{}[]()&*^!@"'`\/#
 
--- DROP RESOURCE GROUP "Rg2_$%{}[]()&*^!@""'`\/#"
+-- DROP RESOURCE GROUP IF EXISTS "Rg2_$%{}[]()&*^!@""'`\/#"
 
 CREATE RESOURCE GROUP "Rg2_$%{}[]()&*^!@""'`\/#";
 
diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/create_resource_group.sql b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/create_resource_group.sql
index a0f5f191..43a70238 100644
--- a/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/create_resource_group.sql
+++ b/web/pgadmin/browser/server_groups/servers/resource_groups/tests/ppas/9.4_plus/create_resource_group.sql
@@ -1,6 +1,6 @@
 -- RESOURCE GROUP: Rg1_$%{}[]()&*^!@"'`\/#
 
--- DROP RESOURCE GROUP "Rg1_$%{}[]()&*^!@""'`\/#"
+-- DROP RESOURCE GROUP IF EXISTS "Rg1_$%{}[]()&*^!@""'`\/#"
 
 CREATE RESOURCE GROUP "Rg1_$%{}[]()&*^!@""'`\/#";
 
diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/sql.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/sql.sql
index 9691aa80..0d255971 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/sql.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.1_plus/sql.sql
@@ -4,7 +4,7 @@ FROM
 (SELECT
 	    '-- Role: '	||
 		pg_catalog.quote_ident(rolname) ||
-		E'\n-- DROP ROLE ' ||
+		E'\n-- DROP ROLE IF EXISTS ' ||
 		pg_catalog.quote_ident(rolname) || E';\n\nCREATE ROLE ' ||
 		pg_catalog.quote_ident(rolname) || E' WITH\n  ' ||
 		CASE WHEN rolcanlogin THEN 'LOGIN' ELSE 'NOLOGIN' END || E'\n  ' ||
diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/sql.sql b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/sql.sql
index ca81e7fa..c64b5633 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/sql.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/templates/roles/sql/9.4_plus/sql.sql
@@ -4,7 +4,7 @@ FROM
 (SELECT
 	    '-- Role: ' ||
 		pg_catalog.quote_ident(rolname) ||
-		E'\n-- DROP ROLE ' ||
+		E'\n-- DROP ROLE IF EXISTS ' ||
 		pg_catalog.quote_ident(rolname) || E';\n\nCREATE ROLE ' ||
 		pg_catalog.quote_ident(rolname) || E' WITH\n  ' ||
 		CASE WHEN rolcanlogin THEN 'LOGIN' ELSE 'NOLOGIN' END || E'\n  ' ||
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_description.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_description.sql
index 5cb6cf67..c2e3d46c 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_description.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_description.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_name.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_name.sql
index c140f044..4ec6c0f9 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_name.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_options.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_options.sql
index 046d0691..3d8db5d2 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_login_role_options.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_description.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_description.sql
index ff2e6620..c3998071 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_description.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_description.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_name.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_name.sql
index 5c757fc9..16fb4471 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_name.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_options.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_options.sql
index fb8b74a7..5a0d12df 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/alter_role_options.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_login_role.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_login_role.sql
index 1b9a2979..478dec60 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_login_role.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_login_role.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_role.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_role.sql
index 7b922588..fd191d4c 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_role.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.1_plus/create_role.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_description.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_description.sql
index 6098d25c..9adaa120 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_description.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_description.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_name.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_name.sql
index 7e4c5e33..5fa66475 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_name.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_options.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_options.sql
index 65008dee..4b91d548 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_options.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_login_role_options.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_description.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_description.sql
index ff2e6620..c3998071 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_description.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_description.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_name.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_name.sql
index 5c757fc9..16fb4471 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_name.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_name.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options1.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options1.sql
index 4c82ac17..f24d8d73 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options1.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options1.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options2.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options2.sql
index bcd7e779..34be0176 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options2.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options2.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options3.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options3.sql
index 17493540..b099718a 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options3.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options3.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options4.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options4.sql
index 89a9da4f..454721fe 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options4.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/alter_role_options4.sql
@@ -1,5 +1,5 @@
 -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role2_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_login_role.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_login_role.sql
index 027c9d89..5f1cadca 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_login_role.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_login_role.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   LOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_role.sql b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_role.sql
index 7b922588..fd191d4c 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_role.sql
+++ b/web/pgadmin/browser/server_groups/servers/roles/tests/9.4_plus/create_role.sql
@@ -1,5 +1,5 @@
 -- Role: "Role1_$%{}[]()&*^!@""'`\/#"
--- DROP ROLE "Role1_$%{}[]()&*^!@""'`\/#";
+-- DROP ROLE IF EXISTS "Role1_$%{}[]()&*^!@""'`\/#";
 
 CREATE ROLE "Role1_$%{}[]()&*^!@""'`\/#" WITH
   NOLOGIN
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index deaf72d2..d1217776 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -588,7 +588,7 @@ class TablespaceView(PGChildNodeView):
         sql_header = """
 -- Tablespace: {0}
 
--- DROP TABLESPACE {0};
+-- DROP TABLESPACE IF EXISTS {0};
 
 """.format(old_data['name'])
 
diff --git a/web/pgadmin/tools/erd/utils.py b/web/pgadmin/tools/erd/utils.py
index fd20835f..ef5520ed 100644
--- a/web/pgadmin/tools/erd/utils.py
+++ b/web/pgadmin/tools/erd/utils.py
@@ -21,7 +21,8 @@ class ERDTableView(BaseTableView, DataTypeReader):
 
     @BaseTableView.check_precondition
     def sql(self, conn_id=None, did=None, sid=None, data={}):
-        return BaseTableView.get_sql(self, did, None, None, data, None)
+        return BaseTableView.get_sql(self, did, None, None, data, None,
+                                     if_exists=True)
 
     @BaseTableView.check_precondition
     def get_types(self, conn_id=None, did=None, sid=None):
diff --git a/web/pgadmin/tools/schema_diff/directory_compare.py b/web/pgadmin/tools/schema_diff/directory_compare.py
index 8a1f5348..47bd5d76 100644
--- a/web/pgadmin/tools/schema_diff/directory_compare.py
+++ b/web/pgadmin/tools/schema_diff/directory_compare.py
@@ -49,6 +49,7 @@ def _get_source_list(**kwargs):
             temp_src_params = copy.deepcopy(source_params)
             temp_src_params['tid'] = source_object_id
             temp_src_params['json_resp'] = False
+            temp_src_params['if_exists'] = True
             source_ddl = \
                 view_object.get_sql_from_table_diff(**temp_src_params)
             temp_src_params.update({'target_schema': target_schema})
@@ -103,6 +104,8 @@ def _delete_keys(temp_tgt_params):
         del temp_tgt_params['gid']
     if 'json_resp' in temp_tgt_params:
         del temp_tgt_params['json_resp']
+    if 'if_exists' in temp_tgt_params:
+        del temp_tgt_params['if_exists']
 
 
 def _get_target_list(removed, target_dict, node, target_params, view_object,
@@ -129,6 +132,7 @@ def _get_target_list(removed, target_dict, node, target_params, view_object,
             temp_tgt_params = copy.deepcopy(target_params)
             temp_tgt_params['tid'] = target_object_id
             temp_tgt_params['json_resp'] = False
+            temp_tgt_params['if_exists'] = True
             target_ddl = view_object.get_sql_from_table_diff(**temp_tgt_params)
             _delete_keys(temp_tgt_params)
             diff_ddl = view_object.get_drop_sql(**temp_tgt_params)
