Handle procedure flags (IMMUTABLE STRICT SECURITY DEFINER PARALLEL RESTRICTED) properly in RE-SQL on EPAS. Fixes #2280

This commit is contained in:
Murtuza Zabuawala 2017-06-05 17:04:55 +01:00 committed by Dave Page
parent a4d86d24e6
commit 3f150f3f4e
3 changed files with 14 additions and 8 deletions

View File

@ -933,6 +933,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
args_without_name = []
cnt = 1
args_list = []
vol_dict = {'v': 'VOLATILE', 's': 'STABLE', 'i': 'IMMUTABLE'}
if 'arguments' in resp_data and len(resp_data['arguments']) > 0:
args_list = resp_data['arguments']
@ -961,6 +962,10 @@ class FunctionView(PGChildNodeView, DataTypeReader):
if self.node_type == 'procedure':
object_type = 'procedure'
if 'provolatile' in resp_data:
resp_data['provolatile'] = vol_dict.get(
resp_data['provolatile'], ''
)
# Get Schema Name from its OID.
if 'pronamespace' in resp_data:

View File

@ -11,10 +11,9 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% if not loop.last %}, {% endif %}
{% endfor -%}
){% endif %}
{% endif %}
{% if query_type != 'create' %}
{{ data.provolatile }}{% if data.proleakproof %} LEAKPROOF {% endif %}
{% endif %}
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.procost %}
@ -23,7 +22,7 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
{% endif %}{% endif %}
{% endif %}
AS
{{ data.prosrc }};

View File

@ -11,18 +11,20 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
{% if not loop.last %}, {% endif %}
{% endfor -%}
){% endif %}
{% endif %}
{% if query_type != 'create' %}
{{ data.provolatile }}{% if data.proleakproof %} LEAKPROOF {% endif %}
{% endif %}
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
{% if data.proisstrict %}STRICT {% endif %}
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
{% if data.proparallel and (data.proparallel == 'r' or data.proparallel == 's') %}
{% if data.proparallel == 'r' %}PARALLEL RESTRICTED{% elif data.proparallel == 's' %}PARALLEL SAFE{% endif %}{% endif %}{% if data.procost %}
COST {{data.procost}}{% endif %}{% if data.prorows %}
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
{% endif %}{% endif %}
{% endif %}
AS
{{ data.prosrc }};