Validate table presence in SQL and Properties route handles. Fixes #2395

This commit is contained in:
Murtuza Zabuawala 2017-05-15 10:15:09 +01:00 committed by Dave Page
parent 3bf17d9df4
commit 2ad14b379e

View File

@ -1108,6 +1108,10 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
status, res = self.conn.execute_dict(SQL)
if not status:
return internal_server_error(errormsg=res)
if len(res['rows']) == 0:
return gone(gettext("The specified table could not be found."))
data = res['rows'][0]
data['vacuum_settings_str'] = ""
@ -1690,8 +1694,7 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
if not status:
return internal_server_error(errormsg=res)
data = res['rows'][0]
# TODO://
# Find SQL which can enable all or disable all triggers
SQL = render_template("/".join([self.template_path,
'enable_disable_trigger.sql']),
data=data, is_enable_trigger=is_enable)
@ -2494,6 +2497,9 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
if not status:
return internal_server_error(errormsg=res)
if len(res['rows']) == 0:
return gone(gettext("The specified table could not be found."))
data = res['rows'][0]
# Table & Schema declaration so that we can use them in child nodes