diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
index cec9615..2a9976e 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py
@@ -412,7 +412,7 @@ class TablespaceView(PGChildNodeView):
 
         if SQL and SQL.strip('\n') and SQL.strip(' '):
             return make_json_response(
-                data=SQL,
+                data=SQL.strip('\n'),
                 status=200
             )
 
@@ -518,7 +518,7 @@ class TablespaceView(PGChildNodeView):
 
         SQL = sql_header + SQL
 
-        return ajax_response(response=SQL)
+        return ajax_response(response=SQL.strip('\n'))
 
 
     @check_precondition
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql
index d39e457..24f818b 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.1_plus/update.sql
@@ -15,7 +15,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }}
 
 {% endif %}
 {# ==== To update tablespace comments ==== #}
-{% if data.description and data.description != o_data.description %}
+{% if data.description is defined  and data.description != o_data.description %}
 COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }}
   IS {{ data.description|qtLiteral }};
 
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql
index aac55b1..f0afd78 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/9.2_plus/update.sql
@@ -16,7 +16,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }}
 
 {% endif %}
 {# ==== To update tablespace comments ==== #}
-{% if data.description and data.description != o_data.description %}
+{% if data.description is defined and data.description != o_data.description %}
 COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }}
   IS {{ data.description|qtLiteral }};
 
diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql
index d39e457..13ca953 100644
--- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/sql/pre_9.1/update.sql
@@ -15,7 +15,7 @@ ALTER TABLESPACE {{ conn|qtIdent(data.name) }}
 
 {% endif %}
 {# ==== To update tablespace comments ==== #}
-{% if data.description and data.description != o_data.description %}
+{% if data.description is defined and data.description != o_data.description %}
 COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }}
   IS {{ data.description|qtLiteral }};
 
