Fixes #1213 - Dropping the materialized view using an non-super user

results into an error - "list index out of range".

Using correct variable name while accessing parameter from an
dictionary.
This commit is contained in:
Surinder Kumar 2016-05-25 00:45:36 +05:30 committed by Ashesh Vashi
parent d4644428e6
commit c0ab396fad

View File

@ -564,20 +564,26 @@ class ViewNode(PGChildNodeView, VacuumSettings):
cascade = True if self.cmd == 'delete' else False
try:
# Get name for view from did
SQL = render_template("/".join(
[self.template_path, 'sql/delete.sql']), vid=vid)
# Get name for view from vid
SQL = render_template(
"/".join([
self.template_path, 'sql/properties.sql'
]),
vid=vid,
datlastsysoid=self.datlastsysoid
)
status, res_data = self.conn.execute_dict(SQL)
if not status:
return internal_server_error(errormsg=res_data)
# drop view
SQL = render_template("/".join(
[self.template_path, 'sql/delete.sql']),
nspname=res_data['rows'][0]['nspname'],
SQL = render_template(
"/".join([
self.template_path, 'sql/delete.sql'
]),
nspname=res_data['rows'][0]['schema'],
name=res_data['rows'][0]['name'], cascade=cascade
)
)
status, res = self.conn.execute_scalar(SQL)
if not status:
return internal_server_error(errormsg=res)