From 26c7d76d4f274a905085bd5a168e428f0defbc50 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Fri, 31 May 2019 11:02:37 +0530 Subject: [PATCH] Fix the issue of accessing the SQL for Views and Materialized Views. Regression of pluralisation of folder names. Fixes #4308 --- docs/en_US/release_notes_4_8.rst | 3 ++- .../servers/databases/schemas/functions/__init__.py | 2 +- .../servers/databases/schemas/sequences/__init__.py | 2 +- .../servers/databases/schemas/tables/indexes/__init__.py | 2 +- .../servers/databases/schemas/views/__init__.py | 8 ++++---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/en_US/release_notes_4_8.rst b/docs/en_US/release_notes_4_8.rst index 7cbe18ce6..363182a4b 100644 --- a/docs/en_US/release_notes_4_8.rst +++ b/docs/en_US/release_notes_4_8.rst @@ -11,4 +11,5 @@ Bug fixes ********* | `Bug #4169 `_ - Omit the geometry viewer in the Query Tool from layout saving. -| `Bug #4307 `_ - Improve the performance of explain plan by embedding the images only when downloading it. \ No newline at end of file +| `Bug #4307 `_ - Improve the performance of explain plan by embedding the images only when downloading it. +| `Bug #4308 `_ - Fix the issue of accessing the SQL for Views and Materialized Views. Regression of pluralisation of folder names. \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py index ba2c90212..e137fa766 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py @@ -1540,7 +1540,7 @@ class FunctionView(PGChildNodeView, DataTypeReader): # Get schema name status, schema_name = self.conn.execute_scalar( render_template( - 'schema/pg/#{0}#/sql/get_name.sql'.format( + 'schemas/pg/#{0}#/sql/get_name.sql'.format( self.manager.version), scid=scid ) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py index 31d37dbed..eff3d9e85 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py @@ -844,7 +844,7 @@ class SequenceView(PGChildNodeView): # Get schema name status, schema_name = self.conn.execute_scalar( render_template( - 'schema/pg/#{0}#/sql/get_name.sql'.format( + 'schemas/pg/#{0}#/sql/get_name.sql'.format( self.manager.version ), scid=scid diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py index fea4ddbfd..239cdbe1e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/__init__.py @@ -83,7 +83,7 @@ class IndexesModule(CollectionNodeModule): if 'vid' not in kwargs: return True - template_path = 'index/sql/#{0}#'.format(manager.version) + template_path = 'indexes/sql/#{0}#'.format(manager.version) SQL = render_template( "/".join([template_path, 'backend_support.sql']), vid=kwargs['vid'] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py index 42bbbff43..670a7f36e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py @@ -771,7 +771,7 @@ class ViewNode(PGChildNodeView, VacuumSettings): Updated properties data with column details """ - self.index_temp_path = 'index' + self.index_temp_path = 'indexes' SQL = render_template("/".join([self.index_temp_path, 'sql/#{0}#/column_details.sql'.format( self.manager.version)]), idx=idx) @@ -825,7 +825,7 @@ class ViewNode(PGChildNodeView, VacuumSettings): Updated properties data with column """ - self.trigger_temp_path = 'schema/trigger' + self.trigger_temp_path = 'schemas/triggers' SQL = render_template("/".join([self.trigger_temp_path, 'get_columns.sql']), tid=tid, clist=clist) @@ -887,7 +887,7 @@ class ViewNode(PGChildNodeView, VacuumSettings): import trigger_definition # Define template path - self.trigger_temp_path = 'trigger' + self.trigger_temp_path = 'triggers' SQL_data = '' SQL = render_template("/".join( @@ -970,7 +970,7 @@ class ViewNode(PGChildNodeView, VacuumSettings): into sql tab """ - self.index_temp_path = 'index' + self.index_temp_path = 'indexes' SQL_data = '' SQL = render_template("/".join( [self.index_temp_path,