diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py b/web/pgadmin/browser/server_groups/servers/tablespaces/__init__.py index cec961586..2a9976ea9 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 d39e457ac..24f818b80 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 aac55b1c1..f0afd78f2 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 d39e457ac..13ca953bb 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 }};