public inbox for [email protected]
help / color / mirror / Atom feedFrom: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM1683 - Reverse engineered SQL for function ALTERs/ACLs is incorrect with OUT parameters
Date: Mon, 12 Sep 2016 15:12:22 +0530
Message-ID: <CAM5-9D_oZ22CaNptwtFMKR-2aEjQDwnr6zeD38sgHK4FW6K3pA@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Please find attached patch with fix.
*Changes:*
1) Take a list of "function argument types", create a string separated by
comma(removing trailing comma).
2) Function arguments in ALTER and GRANT not necessarily to have *argument
mode, name, *they are optional. Only type is required.
Now GRANT statement is represented as
*GRANT EXECUTE ON FUNCTION test_schema.test_func(integer, integer, integer)
TO postgres *as in pgadmin3.
Please review.
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM1683.patch (3.9K, 3-RM1683.patch)
download | inline diff:
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 785ba33..0fbed1b 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
@@ -906,34 +906,34 @@ class FunctionView(PGChildNodeView, DataTypeReader):
resp_data = self._fetch_properties(gid, sid, did, scid, fnid)
# Fetch the function definition.
args = u''
- args_without_name = u''
+ args_without_name = []
cnt = 1
args_list = []
+
if 'arguments' in resp_data and len(resp_data['arguments']) > 0:
args_list = resp_data['arguments']
resp_data['args'] = resp_data['arguments']
for a in args_list:
if (('argmode' in a and a['argmode'] != 'OUT' and
- a['argmode'] is not None
+ a['argmode'] is not None
) or 'argmode' not in a):
if 'argmode' in a:
args += a['argmode'] + " "
- args_without_name += a['argmode'] + " "
if 'argname' in a and a['argname'] != '' \
and a['argname'] is not None:
args += self.qtIdent(
self.conn, a['argname']) + " "
if 'argtype' in a:
args += a['argtype']
- args_without_name += a['argtype']
+ args_without_name.append(a['argtype'])
if cnt < len(args_list):
args += ', '
- args_without_name += ', '
cnt += 1
resp_data['func_args'] = args.strip(' ')
- resp_data['func_args_without'] = args_without_name.strip(' ')
+
+ resp_data['func_args_without'] = ', '.join(args_without_name)
if self.node_type == 'procedure':
object_type = 'procedure'
@@ -1158,7 +1158,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
data['acl'] = parse_priv_to_db(data['acl'], ["X"])
args = u''
- args_without_name = u''
+ args_without_name = []
cnt = 1
args_list = []
if 'arguments' in data and len(data['arguments']) > 0:
@@ -1171,28 +1171,27 @@ class FunctionView(PGChildNodeView, DataTypeReader):
) or 'argmode' not in a):
if 'argmode' in a:
args += a['argmode'] + " "
- args_without_name += a['argmode'] + " "
if 'argname' in a and a['argname'] != '' \
and a['argname'] is not None:
args += self.qtIdent(
self.conn, a['argname']) + " "
if 'argtype' in a:
args += a['argtype']
- args_without_name += a['argtype']
+ args_without_name.append(a['argtype'])
if cnt < len(args_list):
args += ', '
- args_without_name += ', '
+ args_without_name += ','
cnt += 1
data['func_args'] = args.strip(' ')
- data['func_args_without'] = args_without_name.strip(' ')
+
+ data['func_args_without'] = ', '.join(args_without_name)
# Create mode
SQL = render_template("/".join([self.sql_template_path,
'create.sql']),
data=data, is_sql=is_sql)
return True, SQL.strip('\n')
-
def _fetch_properties(self, gid, sid, did, scid, fnid=None):
"""
Return Function Properties which will be used in properties,
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch]: RM1683 - Reverse engineered SQL for function ALTERs/ACLs is incorrect with OUT parameters
In-Reply-To: <CAM5-9D_oZ22CaNptwtFMKR-2aEjQDwnr6zeD38sgHK4FW6K3pA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox