diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/delete.sql b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/delete.sql
index a3ca72bb..953c4eeb 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/delete.sql
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/delete.sql
@@ -10,4 +10,4 @@ DELETE FROM {{ conn|qtIdent(nsp_name, object_name) }}
         ({% for obj in data %}{% if no_of_keys == 1 %}{{ obj[primary_key_labels[0]]|qtLiteral }}{% elif no_of_keys > 1 %}
 {### Here we need to make tuple for each row ###}
 ({% for each_label in primary_key_labels %}{{ obj[each_label]|qtLiteral }}{% if not loop.last %}, {% endif %}{% endfor %}){% endif %}{% if not loop.last %}, {% endif %}
-{% endfor %});
\ No newline at end of file
+{% endfor %});
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/insert.sql b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/insert.sql
index a1b35ee8..63af3669 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/insert.sql
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/insert.sql
@@ -1,10 +1,10 @@
 {# Insert the new row with primary keys (specified in primary_keys) #}
-INSERT INTO {{ conn|qtIdent(nsp_name, object_name) }} (
+INSERT INTO {{ conn|qtIdent(nsp_name, object_name) | replace("%", "%%") }} (
 {% for col in data_to_be_saved %}
-{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) }}{% endfor %}
+{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) | replace("%", "%%") }}{% endfor %}
 ) VALUES (
 {% for col in data_to_be_saved %}
 {% if not loop.first %}, {% endif %}%({{ pgadmin_alias[col] }})s{% if type_cast_required[col] %}::{{ data_type[col] }}{% endif %}{% endfor %}
 )
-{% if pk_names and not has_oids %} returning {{pk_names}}{% endif %}
+{% if pk_names and not has_oids %} returning {{pk_names | replace("%", "%%")}}{% endif %}
 {% if has_oids %} returning oid{% endif %};
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/select.sql b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/select.sql
index 1bf7428b..a509b4a4 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/select.sql
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/select.sql
@@ -1,9 +1,9 @@
 {# Select table rows #}
-SELECT {% if has_oids %}oid, {% endif %}* FROM {{ conn|qtIdent(nsp_name, object_name) }}
+SELECT {% if has_oids %}oid, {% endif %}* FROM {{ conn|qtIdent(nsp_name, object_name) | replace("%", "%%") }}
 WHERE
 {% if has_oids %}
   oid = %(oid)s
 {% elif primary_keys|length > 0 %}
   {% for pk in primary_keys %}
-    {% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) }} = %({{ pgadmin_alias[pk] }})s{% endfor %}
+    {% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) | replace("%", "%%") }} = %({{ pgadmin_alias[pk] }})s{% endfor %}
 {% endif %};
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/update.sql b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/update.sql
index b2559fd8..43b0ee7a 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/update.sql
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/sql/default/update.sql
@@ -1,7 +1,7 @@
 {# Update the row with primary keys (specified in primary_keys) #}
-UPDATE {{ conn|qtIdent(nsp_name, object_name) }} SET
+UPDATE {{ conn|qtIdent(nsp_name, object_name) | replace("%", "%%") }} SET
 {% for col in data_to_be_saved %}
-{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) }} = %({{ pgadmin_alias[col] }})s{% if type_cast_required[col] %}::{{ data_type[col] }}{% endif %}{% endfor %}
+{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) | replace("%", "%%") }} = %({{ pgadmin_alias[col] }})s{% if type_cast_required[col] %}::{{ data_type[col] }}{% endif %}{% endfor %}
  WHERE
 {% for pk in primary_keys %}
-{% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) }} = {{ primary_keys[pk]|qtLiteral }}{% endfor %};
+{% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) | replace("%", "%%") }} = {{ primary_keys[pk]|qtLiteral }}{% endfor %};
diff --git a/web/pgadmin/tools/sqleditor/utils/save_changed_data.py b/web/pgadmin/tools/sqleditor/utils/save_changed_data.py
index 3997d93b..27d927a6 100644
--- a/web/pgadmin/tools/sqleditor/utils/save_changed_data.py
+++ b/web/pgadmin/tools/sqleditor/utils/save_changed_data.py
@@ -36,8 +36,6 @@ def save_changed_data(changed_data, columns_info, conn, command_obj,
     operations = ('added', 'updated', 'deleted')
     list_of_sql = {}
     _rowid = None
-    # Replace '%' with '%%' as python use '%' as string formatting.
-    command_obj.object_name = command_obj.object_name.replace('%', '%%')
 
     pgadmin_alias = {
         col_name: col_info['pgadmin_alias']
diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py
index c90d2439..3b7f3d5b 100644
--- a/web/pgadmin/utils/driver/psycopg2/connection.py
+++ b/web/pgadmin/utils/driver/psycopg2/connection.py
@@ -1970,5 +1970,9 @@ Failed to reset the connection to the server due to following error:
         if not status:
             return None
         else:
-            mogrified_sql = cursor.mogrify(query, parameters)
-            return mogrified_sql
+
+            if parameters:
+                mogrified_sql = cursor.mogrify(query, parameters)
+                return mogrified_sql
+            else:
+                return query
