From 9c3925e44821f218448c4d60faa2af7fee7dfb7d Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 10 Apr 2019 13:22:52 +0530 Subject: [PATCH] Ensure that parameters of procedures for EPAS server 10 and below should be set/reset properly. Fixes #4161 --- docs/en_US/release_notes_4_6.rst | 3 ++- .../templates/procedure/ppas/sql/9.5_plus/update.sql | 4 ++-- .../templates/procedure/ppas/sql/9.6_plus/update.sql | 4 ++-- .../schemas/templates/macros/functions/variable.macros | 10 ++++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/en_US/release_notes_4_6.rst b/docs/en_US/release_notes_4_6.rst index 54ff79475..64e90b9b2 100644 --- a/docs/en_US/release_notes_4_6.rst +++ b/docs/en_US/release_notes_4_6.rst @@ -14,4 +14,5 @@ Features Bug fixes ********* -| `Bug #4138 `_ - Fix an issue where the dropdown becomes misaligned/displaced. \ No newline at end of file +| `Bug #4138 `_ - Fix an issue where the dropdown becomes misaligned/displaced. +| `Bug #4161 `_ - Ensure that parameters of procedures for EPAS server 10 and below should be set/reset properly. \ No newline at end of file diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/update.sql index f7c623c75..f20b60634 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/update.sql @@ -61,11 +61,11 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg {% if data.variables %} {% if 'deleted' in data.variables and data.variables.deleted|length > 0 %} -{{ VARIABLE.UNSET(conn, 'PROCEDURE', name, data.variables.deleted, o_data.pronamespace, o_data.proargtypenames) }} +{{ VARIABLE.UNSET(conn, 'PROCEDURE', name, data.variables.deleted, o_data.pronamespace) }} {% endif -%} {% if 'merged_variables' in data and data.merged_variables|length > 0 %} -{{ VARIABLE.SET(conn, 'PROCEDURE', name, data.merged_variables, o_data.pronamespace, o_data.proargtypenames) }} +{{ VARIABLE.SET(conn, 'PROCEDURE', name, data.merged_variables, o_data.pronamespace) }} {% endif -%} {% endif -%} {% endif -%} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/update.sql index 28942d891..251a89c2e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/update.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/update.sql @@ -63,11 +63,11 @@ ALTER PROCEDURE {{ conn|qtIdent(o_data.pronamespace, name) }}{% if o_data.proarg {% if data.variables %} {% if 'deleted' in data.variables and data.variables.deleted|length > 0 %} -{{ VARIABLE.UNSET(conn, 'PROCEDURE', name, data.variables.deleted, o_data.pronamespace, o_data.proargtypenames) }} +{{ VARIABLE.UNSET(conn, 'PROCEDURE', name, data.variables.deleted, o_data.pronamespace) }} {% endif -%} {% if 'merged_variables' in data and data.merged_variables|length > 0 %} -{{ VARIABLE.SET(conn, 'PROCEDURE', name, data.merged_variables, o_data.pronamespace, o_data.proargtypenames) }} +{{ VARIABLE.SET(conn, 'PROCEDURE', name, data.merged_variables, o_data.pronamespace) }} {% endif -%} {% endif -%} {% endif -%} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/macros/functions/variable.macros b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/macros/functions/variable.macros index c8ba9c1ac..30ddbc902 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/macros/functions/variable.macros +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/macros/functions/variable.macros @@ -4,7 +4,10 @@ {% macro SET(conn, object_type, object_name, options, schema, func_args) -%} {% for opt in options %} -ALTER {{object_type}} {{ conn|qtIdent(schema, object_name) }}({{func_args}}) +ALTER {{object_type}} {{ conn|qtIdent(schema, object_name) }}{% if func_args is defined %}({{func_args}}) +{% else %} + +{% endif %} SET {{ conn|qtIdent(opt.name) }}={{ opt.value }}; {% endfor %} @@ -12,7 +15,10 @@ ALTER {{object_type}} {{ conn|qtIdent(schema, object_name) }}({{func_args}}) {% macro UNSET(conn, object_type, object_name, options, schema, func_args) -%} {% for opt in options %} -ALTER {{object_type}} {{ conn|qtIdent(schema, object_name) }}({{func_args}}) +ALTER {{object_type}} {{ conn|qtIdent(schema, object_name) }}{% if func_args is defined %}({{func_args}}) +{% else %} + +{% endif %} RESET {{ conn|qtIdent(opt.name) }}; {% endfor %}