mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where Tablespace is created though an error is shown on the dialog. Fixes #6745
This commit is contained in:
committed by
Akshay Joshi
parent
02b83146be
commit
461c0abce1
@@ -322,16 +322,6 @@ class TablespaceView(PGChildNodeView):
|
||||
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._ALTER_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
|
||||
# Checking if we are not executing empty query
|
||||
if SQL and SQL.strip('\n') and SQL.strip(' '):
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
# To fetch the oid of newly created tablespace
|
||||
SQL = render_template(
|
||||
@@ -344,6 +334,32 @@ class TablespaceView(PGChildNodeView):
|
||||
if not status:
|
||||
return internal_server_error(errormsg=tsid)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, self._ALTER_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
|
||||
# Checking if we are not executing empty query
|
||||
if SQL and SQL.strip('\n') and SQL.strip(' '):
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return jsonify(
|
||||
node=self.blueprint.generate_browser_node(
|
||||
tsid,
|
||||
sid,
|
||||
data['name'],
|
||||
icon="icon-tablespace"
|
||||
),
|
||||
success=0,
|
||||
errormsg=gettext(
|
||||
'Tablespace created successfully, '
|
||||
'Set parameter fail: {0}'.format(res)
|
||||
),
|
||||
info=gettext(
|
||||
res
|
||||
)
|
||||
)
|
||||
|
||||
return jsonify(
|
||||
node=self.blueprint.generate_browser_node(
|
||||
tsid,
|
||||
|
||||
Reference in New Issue
Block a user