mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Handle procedure flags (IMMUTABLE STRICT SECURITY DEFINER PARALLEL RESTRICTED) properly in RE-SQL on EPAS. Fixes #2280
This commit is contained in:
committed by
Dave Page
parent
a4d86d24e6
commit
3f150f3f4e
@@ -933,6 +933,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
|
|||||||
args_without_name = []
|
args_without_name = []
|
||||||
cnt = 1
|
cnt = 1
|
||||||
args_list = []
|
args_list = []
|
||||||
|
vol_dict = {'v': 'VOLATILE', 's': 'STABLE', 'i': 'IMMUTABLE'}
|
||||||
|
|
||||||
if 'arguments' in resp_data and len(resp_data['arguments']) > 0:
|
if 'arguments' in resp_data and len(resp_data['arguments']) > 0:
|
||||||
args_list = resp_data['arguments']
|
args_list = resp_data['arguments']
|
||||||
@@ -961,6 +962,10 @@ class FunctionView(PGChildNodeView, DataTypeReader):
|
|||||||
|
|
||||||
if self.node_type == 'procedure':
|
if self.node_type == 'procedure':
|
||||||
object_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.
|
# Get Schema Name from its OID.
|
||||||
if 'pronamespace' in resp_data:
|
if 'pronamespace' in resp_data:
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
|
|||||||
{% if not loop.last %}, {% endif %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
){% endif %}
|
){% endif %}
|
||||||
{% endif %}
|
|
||||||
{% if query_type != 'create' %}
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
|
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
|
||||||
{% if data.proisstrict %}STRICT {% endif %}
|
{% if data.proisstrict %}STRICT {% endif %}
|
||||||
{% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.procost %}
|
{% 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 %}
|
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
|
||||||
|
|
||||||
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
|
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
|
||||||
{% endif %}{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
AS
|
AS
|
||||||
{{ data.prosrc }};
|
{{ data.prosrc }};
|
||||||
|
|||||||
@@ -11,18 +11,20 @@ CREATE OR REPLACE PROCEDURE {{ conn|qtIdent(data.pronamespace, data.name) }}{% i
|
|||||||
{% if not loop.last %}, {% endif %}
|
{% if not loop.last %}, {% endif %}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
){% endif %}
|
){% endif %}
|
||||||
{% endif %}
|
|
||||||
{% if query_type != 'create' %}
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
|
{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
|
||||||
{% if data.proisstrict %}STRICT {% endif %}
|
{% if data.proisstrict %}STRICT {% endif %}
|
||||||
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
|
{% if data.prosecdef %}SECURITY DEFINER {% endif %}
|
||||||
{% if data.proparallel and (data.proparallel == 'r' or data.proparallel == 's') %}
|
{% 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 %}
|
{% if data.proparallel == 'r' %}PARALLEL RESTRICTED{% elif data.proparallel == 's' %}PARALLEL SAFE{% endif %}{% endif %}{% if data.procost %}
|
||||||
|
|
||||||
COST {{data.procost}}{% endif %}{% if data.prorows %}
|
COST {{data.procost}}{% endif %}{% if data.prorows %}
|
||||||
|
|
||||||
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
|
ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in data.variables %}
|
||||||
|
|
||||||
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
|
SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
|
||||||
{% endif %}{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
AS
|
AS
|
||||||
{{ data.prosrc }};
|
{{ data.prosrc }};
|
||||||
|
|||||||
Reference in New Issue
Block a user