Обсуждение: [pgAdmin4][Patch]: Functions/Procedures Module
Hi,
Please find attached patch for the Functions/Procedures Module.To test this patch, "Unique collection Control and Variable Control Fixes" Patch submitted by me needs to be applied first.
Вложения
Hi On Fri, Mar 11, 2016 at 9:34 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: > Hi, > > Please find attached patch for the Functions/Procedures Module. > > To test this patch, "Unique collection Control and Variable Control Fixes" > Patch submitted by me needs to be applied first. Hi, This is looking pretty good. I did a little bit of cleanup of the SQL formatting, however I think a little more is needed; - When creating a function, we might get the following: ===== CREATE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123) RETURNS bigint AS $BODY$SELECT $1;$BODY$ LANGUAGE 'sql' NOT LEAKPROOF SET backslash_quote='on'; ALTER FUNCTION pem.whee(INOUT foo bigint ) OWNER TO postgres; GRANT ALL ON FUNCTION pem.whee(INOUT foo bigint ) TO pem_user; COMMENT ON FUNCTION pem.whee(INOUT foo bigint ) IS 'whee func'; ===== - Remove the spaces after the argument lists, before the ) - Remove the double blank lines - The opening $BODY$ should be indented - LANGUAGE should be indented - The are two spaces between 'sql' and NOT. - Reverse engineered SQL may look like: ===== -- FUNCTION: pem.whee(INOUT foo bigint) -- DROP FUNCTION pem.whee(INOUT foo bigint); CREATE OR REPLACE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123) RETURNS bigint LANGUAGE sql SET backslash_quote TO 'on' AS $function$SELECT $1;$function$ ===== - We should be consistent with our heredoc markers ($BODY$ vs. $function$) - There's a 1 space indent - This formatting (bar the issues above) is much nicer that the CREATE formatting. I haven't found anything else of note yet, that I haven't fixed in passing (though I have yet to test with PPAS). Updated patch attached. Thanks. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Вложения
Hi,
Please find updated Patch for the Functions/Procedures Module.On Fri, Mar 11, 2016 at 10:17 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi
On Fri, Mar 11, 2016 at 9:34 AM, Khushboo Vashi
<khushboo.vashi@enterprisedb.com> wrote:
> Hi,
>
> Please find attached patch for the Functions/Procedures Module.
>
> To test this patch, "Unique collection Control and Variable Control Fixes"
> Patch submitted by me needs to be applied first.
Hi,
This is looking pretty good. I did a little bit of cleanup of the SQL
formatting, however I think a little more is needed;
- When creating a function, we might get the following:
=====
CREATE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123) RETURNS bigint AS
$BODY$SELECT $1;$BODY$
LANGUAGE 'sql' NOT LEAKPROOF
SET backslash_quote='on';
ALTER FUNCTION pem.whee(INOUT foo bigint )
OWNER TO postgres;
GRANT ALL ON FUNCTION pem.whee(INOUT foo bigint ) TO pem_user;
COMMENT ON FUNCTION pem.whee(INOUT foo bigint )
IS 'whee func';
=====
- Remove the spaces after the argument lists, before the )
Done
- Remove the double blank lines
Done
- The opening $BODY$ should be indented
Done and also replaced it with $function
- LANGUAGE should be indented
Done
- The are two spaces between 'sql' and NOT.
I have put function options into the next line as Reverse engineered SQL
- Reverse engineered SQL may look like:
=====
-- FUNCTION: pem.whee(INOUT foo bigint)
-- DROP FUNCTION pem.whee(INOUT foo bigint);
CREATE OR REPLACE FUNCTION pem.whee(INOUT foo bigint DEFAULT 123)
RETURNS bigint
LANGUAGE sql
SET backslash_quote TO 'on'
AS $function$SELECT $1;$function$
=====
- We should be consistent with our heredoc markers ($BODY$ vs. $function$)
Replaced $BODY with $function
- There's a 1 space indent
As per our discussion, will not fix this 1 space indent because the Function definition SQL is coming from pg_def_functiondef function
- This formatting (bar the issues above) is much nicer that the
CREATE formatting.
I haven't found anything else of note yet, that I haven't fixed in
passing (though I have yet to test with PPAS). Updated patch attached.
Thanks.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения
On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: > Hi, > > Please find updated Patch for the Functions/Procedures Module. Hi Unfortunately I found more issues as I tested in-depth. I've attached an updated patch in which I've done some cleanup - additional comments below: - Some argument lists are shown with an extra space, e.g. character varying , integer (pem.create_agent(character varying , integer)) - A 404 error is seen when functions are selected under a Catalog node. - Procedures have a property of "System function?" - should be "System procedure?" - The Return Type, Returns a Set and Window fields should be hidden for Procedures. - When creating a procedure (below), I get the following error: ----- -- PROCEDURE: foo -- DROP PROCEDURE foo; CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT b integer DEFAULT -) VOLATILE NOT LEAKPROOF SECURITY DEFINER COST 100.0 AS BEGIN b:=a+b+1; END; COMMENT ON PROCEDURE public.foo IS 'Foo procedure'; ----- ----- 2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1" 500 - Traceback (most recent call last): File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line 233, in dispatch_request return method(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", line 349, in wrap return f(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", line 425, in properties resp_data = self._fetch_properties(gid, sid, did, scid, fnid) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", line 1097, in _fetch_properties resp_data = res['rows'][0] IndexError: list index out of range ----- - After a Python server reset, I get the following error when trying to view SQL of a Procedure (seems like it thinks it's connected to PG?): TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql 2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500 - Traceback (most recent call last): File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line 233, in dispatch_request return method(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", line 349, in wrap return f(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", line 390, in nodes 'node.sql']), scid=scid) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", line 127, in render_template return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", line 791, in get_template return self._load_template(name, self.make_globals(globals)) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", line 765, in _load_template template = self.loader.load(self, name, globals) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py", line 113, in load source, filename, uptodate = self.get_source(environment, name) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", line 64, in get_source raise TemplateNotFound(template) TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql 2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 11:28:57] "POST /ping HTTP/1.1" 200 - - Procedures do not include the schema name in the headers of reverse engineered SQL, e.g. - What's the trailing - in the parameter list in this reverse engineered SQL? -- PROCEDURE: foo -- DROP PROCEDURE foo; CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT b integer DEFAULT -) VOLATILE NOT LEAKPROOF SECURITY DEFINER COST 100.0 AS BEGIN b:=a+b+1; END; COMMENT ON PROCEDURE public.foo IS 'Foo procedure'; Thanks! -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Hi Dave,
I think you forgot to attach the updated patch.On Wed, Mar 23, 2016 at 5:33 PM, Dave Page <dpage@pgadmin.org> wrote:
On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi
<khushboo.vashi@enterprisedb.com> wrote:
> Hi,
>
> Please find updated Patch for the Functions/Procedures Module.
Hi
Unfortunately I found more issues as I tested in-depth. I've attached
an updated patch in which I've done some cleanup - additional comments
below:
- Some argument lists are shown with an extra space, e.g.
character varying , integer
(pem.create_agent(character varying , integer))
- A 404 error is seen when functions are selected under a Catalog node.
- Procedures have a property of "System function?" - should be "System
procedure?"
- The Return Type, Returns a Set and Window fields should be hidden
for Procedures.
- When creating a procedure (below), I get the following error:
-----
-- PROCEDURE: foo
-- DROP PROCEDURE foo;
CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT
b integer DEFAULT -)
VOLATILE NOT LEAKPROOF SECURITY DEFINER
COST 100.0
AS
BEGIN
b:=a+b+1;
END;
COMMENT ON PROCEDURE public.foo
IS 'Foo procedure';
-----
-----
2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1"
500 -
Traceback (most recent call last):
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
233, in dispatch_request
return method(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 349, in wrap
return f(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 425, in properties
resp_data = self._fetch_properties(gid, sid, did, scid, fnid)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 1097, in _fetch_properties
resp_data = res['rows'][0]
IndexError: list index out of range
-----
- After a Python server reset, I get the following error when trying
to view SQL of a Procedure (seems like it thinks it's connected to
PG?):
TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql
2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500
-
Traceback (most recent call last):
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
233, in dispatch_request
return method(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 349, in wrap
return f(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 390, in nodes
'node.sql']), scid=scid)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py",
line 127, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 830, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 791, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 765, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py",
line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py",
line 64, in get_source
raise TemplateNotFound(template)
TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql
2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:28:57] "POST /ping HTTP/1.1" 200 -
- Procedures do not include the schema name in the headers of reverse
engineered SQL, e.g.
- What's the trailing - in the parameter list in this reverse engineered SQL?
-- PROCEDURE: foo
-- DROP PROCEDURE foo;
CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT
b integer DEFAULT -)
VOLATILE NOT LEAKPROOF SECURITY DEFINER
COST 100.0
AS
BEGIN
b:=a+b+1;
END;
COMMENT ON PROCEDURE public.foo
IS 'Foo procedure';
Thanks!
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Ooops :-) On Wed, Mar 23, 2016 at 1:44 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: > Hi Dave, > > I think you forgot to attach the updated patch. > > Thanks, > Khushboo > > On Wed, Mar 23, 2016 at 5:33 PM, Dave Page <dpage@pgadmin.org> wrote: >> >> On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi >> <khushboo.vashi@enterprisedb.com> wrote: >> > Hi, >> > >> > Please find updated Patch for the Functions/Procedures Module. >> >> Hi >> >> Unfortunately I found more issues as I tested in-depth. I've attached >> an updated patch in which I've done some cleanup - additional comments >> below: >> >> - Some argument lists are shown with an extra space, e.g. >> >> character varying , integer >> >> (pem.create_agent(character varying , integer)) >> >> - A 404 error is seen when functions are selected under a Catalog node. >> >> - Procedures have a property of "System function?" - should be "System >> procedure?" >> >> - The Return Type, Returns a Set and Window fields should be hidden >> for Procedures. >> >> - When creating a procedure (below), I get the following error: >> >> ----- >> -- PROCEDURE: foo >> >> -- DROP PROCEDURE foo; >> >> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >> b integer DEFAULT -) >> VOLATILE NOT LEAKPROOF SECURITY DEFINER >> COST 100.0 >> AS >> >> BEGIN >> b:=a+b+1; >> END; >> >> COMMENT ON PROCEDURE public.foo >> IS 'Foo procedure'; >> ----- >> >> ----- >> 2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1" >> 500 - >> Traceback (most recent call last): >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1836, in __call__ >> return self.wsgi_app(environ, start_response) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1820, in wsgi_app >> response = self.make_response(self.handle_exception(e)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1403, in handle_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1381, in handle_user_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1475, in full_dispatch_request >> rv = self.dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1461, in dispatch_request >> return self.view_functions[rule.endpoint](**req.view_args) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >> line 84, in view >> return self.dispatch_request(*args, **kwargs) >> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >> 233, in dispatch_request >> return method(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 349, in wrap >> return f(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 425, in properties >> resp_data = self._fetch_properties(gid, sid, did, scid, fnid) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 1097, in _fetch_properties >> resp_data = res['rows'][0] >> IndexError: list index out of range >> ----- >> >> - After a Python server reset, I get the following error when trying >> to view SQL of a Procedure (seems like it thinks it's connected to >> PG?): >> >> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >> 2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500 >> - >> Traceback (most recent call last): >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1836, in __call__ >> return self.wsgi_app(environ, start_response) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1820, in wsgi_app >> response = self.make_response(self.handle_exception(e)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1403, in handle_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1381, in handle_user_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1475, in full_dispatch_request >> rv = self.dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1461, in dispatch_request >> return self.view_functions[rule.endpoint](**req.view_args) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >> line 84, in view >> return self.dispatch_request(*args, **kwargs) >> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >> 233, in dispatch_request >> return method(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 349, in wrap >> return f(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 390, in nodes >> 'node.sql']), scid=scid) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >> line 127, in render_template >> return >> _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 830, in get_or_select_template >> return self.get_template(template_name_or_list, parent, globals) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 791, in get_template >> return self._load_template(name, self.make_globals(globals)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 765, in _load_template >> template = self.loader.load(self, name, globals) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py", >> line 113, in load >> source, filename, uptodate = self.get_source(environment, name) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >> line 64, in get_source >> raise TemplateNotFound(template) >> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >> 2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:28:57] "POST /ping HTTP/1.1" 200 - >> >> - Procedures do not include the schema name in the headers of reverse >> engineered SQL, e.g. >> >> - What's the trailing - in the parameter list in this reverse engineered >> SQL? >> >> -- PROCEDURE: foo >> >> -- DROP PROCEDURE foo; >> >> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >> b integer DEFAULT -) >> VOLATILE NOT LEAKPROOF SECURITY DEFINER >> COST 100.0 >> AS >> >> BEGIN >> b:=a+b+1; >> END; >> >> COMMENT ON PROCEDURE public.foo >> IS 'Foo procedure'; >> >> Thanks! >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Вложения
Hi,
Please find updated patch for the functions/procedures module.On Wed, Mar 23, 2016 at 5:33 PM, Dave Page <dpage@pgadmin.org> wrote:
On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi
<khushboo.vashi@enterprisedb.com> wrote:
> Hi,
>
> Please find updated Patch for the Functions/Procedures Module.
Hi
Unfortunately I found more issues as I tested in-depth. I've attached
an updated patch in which I've done some cleanup - additional comments
below:
- Some argument lists are shown with an extra space, e.g.
character varying , integer
(pem.create_agent(character varying , integer))
Done
- A 404 error is seen when functions are selected under a Catalog node.
Done
- Procedures have a property of "System function?" - should be "System
procedure?"
Done
- The Return Type, Returns a Set and Window fields should be hidden
for Procedures.
Done
- When creating a procedure (below), I get the following error:
-----
-- PROCEDURE: foo
-- DROP PROCEDURE foo;
CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT
b integer DEFAULT -)
VOLATILE NOT LEAKPROOF SECURITY DEFINER
COST 100.0
AS
BEGIN
b:=a+b+1;
END;
COMMENT ON PROCEDURE public.foo
IS 'Foo procedure';
-----
-----
2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1"
500 -
Traceback (most recent call last):
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
233, in dispatch_request
return method(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 349, in wrap
return f(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 425, in properties
resp_data = self._fetch_properties(gid, sid, did, scid, fnid)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 1097, in _fetch_properties
resp_data = res['rows'][0]
IndexError: list index out of range
-----
- After a Python server reset, I get the following error when trying
to view SQL of a Procedure (seems like it thinks it's connected to
PG?):
TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql
2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500
-
Traceback (most recent call last):
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
233, in dispatch_request
return method(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 349, in wrap
return f(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py",
line 390, in nodes
'node.sql']), scid=scid)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py",
line 127, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 830, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 791, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py",
line 765, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py",
line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py",
line 64, in get_source
raise TemplateNotFound(template)
TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql
2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016
11:28:57] "POST /ping HTTP/1.1" 200 -
Done
- Procedures do not include the schema name in the headers of reverse
engineered SQL, e.g.
Done
- What's the trailing - in the parameter list in this reverse engineered SQL?
-- PROCEDURE: foo
-- DROP PROCEDURE foo;
CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT
b integer DEFAULT -)
VOLATILE NOT LEAKPROOF SECURITY DEFINER
COST 100.0
AS
BEGIN
b:=a+b+1;
END;
COMMENT ON PROCEDURE public.foo
IS 'Foo procedure';
Done
Thanks!
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения
Thanks - committed. On Mon, Mar 28, 2016 at 8:26 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: > Hi, > > Please find updated patch for the functions/procedures module. > > Thanks, > Khushboo > > On Wed, Mar 23, 2016 at 5:33 PM, Dave Page <dpage@pgadmin.org> wrote: >> >> On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi >> <khushboo.vashi@enterprisedb.com> wrote: >> > Hi, >> > >> > Please find updated Patch for the Functions/Procedures Module. >> >> Hi >> >> Unfortunately I found more issues as I tested in-depth. I've attached >> an updated patch in which I've done some cleanup - additional comments >> below: >> >> - Some argument lists are shown with an extra space, e.g. >> >> character varying , integer >> >> (pem.create_agent(character varying , integer)) > > Done >> >> - A 404 error is seen when functions are selected under a Catalog node. > > Done >> >> - Procedures have a property of "System function?" - should be "System >> procedure?" >> > Done >> >> - The Return Type, Returns a Set and Window fields should be hidden >> for Procedures. >> > Done >> >> - When creating a procedure (below), I get the following error: >> >> ----- >> -- PROCEDURE: foo >> >> -- DROP PROCEDURE foo; >> >> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >> b integer DEFAULT -) >> VOLATILE NOT LEAKPROOF SECURITY DEFINER >> COST 100.0 >> AS >> >> BEGIN >> b:=a+b+1; >> END; >> >> COMMENT ON PROCEDURE public.foo >> IS 'Foo procedure'; >> ----- >> >> ----- >> 2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1" >> 500 - >> Traceback (most recent call last): >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1836, in __call__ >> return self.wsgi_app(environ, start_response) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1820, in wsgi_app >> response = self.make_response(self.handle_exception(e)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1403, in handle_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1381, in handle_user_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1475, in full_dispatch_request >> rv = self.dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1461, in dispatch_request >> return self.view_functions[rule.endpoint](**req.view_args) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >> line 84, in view >> return self.dispatch_request(*args, **kwargs) >> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >> 233, in dispatch_request >> return method(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 349, in wrap >> return f(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 425, in properties >> resp_data = self._fetch_properties(gid, sid, did, scid, fnid) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 1097, in _fetch_properties >> resp_data = res['rows'][0] >> IndexError: list index out of range >> ----- >> >> - After a Python server reset, I get the following error when trying >> to view SQL of a Procedure (seems like it thinks it's connected to >> PG?): >> >> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >> 2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500 >> - >> Traceback (most recent call last): >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1836, in __call__ >> return self.wsgi_app(environ, start_response) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1820, in wsgi_app >> response = self.make_response(self.handle_exception(e)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1403, in handle_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1381, in handle_user_exception >> reraise(exc_type, exc_value, tb) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1475, in full_dispatch_request >> rv = self.dispatch_request() >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >> line 1461, in dispatch_request >> return self.view_functions[rule.endpoint](**req.view_args) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >> line 84, in view >> return self.dispatch_request(*args, **kwargs) >> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >> 233, in dispatch_request >> return method(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 349, in wrap >> return f(*args, **kwargs) >> File >> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >> line 390, in nodes >> 'node.sql']), scid=scid) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >> line 127, in render_template >> return >> _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 830, in get_or_select_template >> return self.get_template(template_name_or_list, parent, globals) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 791, in get_template >> return self._load_template(name, self.make_globals(globals)) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >> line 765, in _load_template >> template = self.loader.load(self, name, globals) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py", >> line 113, in load >> source, filename, uptodate = self.get_source(environment, name) >> File >> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >> line 64, in get_source >> raise TemplateNotFound(template) >> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >> 2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >> 11:28:57] "POST /ping HTTP/1.1" 200 - >> > Done >> >> - Procedures do not include the schema name in the headers of reverse >> engineered SQL, e.g. >> > Done >> >> - What's the trailing - in the parameter list in this reverse engineered >> SQL? >> >> -- PROCEDURE: foo >> >> -- DROP PROCEDURE foo; >> >> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >> b integer DEFAULT -) >> VOLATILE NOT LEAKPROOF SECURITY DEFINER >> COST 100.0 >> AS >> >> BEGIN >> b:=a+b+1; >> END; >> >> COMMENT ON PROCEDURE public.foo >> IS 'Foo procedure'; >> > Done >> >> Thanks! >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
I'm getting weirdness with this node. See the attached picture, where it shows the servers node appearing under functions. Thom On 5 April 2016 at 16:21, Dave Page <dpage@pgadmin.org> wrote: > Thanks - committed. > > On Mon, Mar 28, 2016 at 8:26 AM, Khushboo Vashi > <khushboo.vashi@enterprisedb.com> wrote: >> Hi, >> >> Please find updated patch for the functions/procedures module. >> >> Thanks, >> Khushboo >> >> On Wed, Mar 23, 2016 at 5:33 PM, Dave Page <dpage@pgadmin.org> wrote: >>> >>> On Tue, Mar 22, 2016 at 10:51 AM, Khushboo Vashi >>> <khushboo.vashi@enterprisedb.com> wrote: >>> > Hi, >>> > >>> > Please find updated Patch for the Functions/Procedures Module. >>> >>> Hi >>> >>> Unfortunately I found more issues as I tested in-depth. I've attached >>> an updated patch in which I've done some cleanup - additional comments >>> below: >>> >>> - Some argument lists are shown with an extra space, e.g. >>> >>> character varying , integer >>> >>> (pem.create_agent(character varying , integer)) >> >> Done >>> >>> - A 404 error is seen when functions are selected under a Catalog node. >> >> Done >>> >>> - Procedures have a property of "System function?" - should be "System >>> procedure?" >>> >> Done >>> >>> - The Return Type, Returns a Set and Window fields should be hidden >>> for Procedures. >>> >> Done >>> >>> - When creating a procedure (below), I get the following error: >>> >>> ----- >>> -- PROCEDURE: foo >>> >>> -- DROP PROCEDURE foo; >>> >>> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >>> b integer DEFAULT -) >>> VOLATILE NOT LEAKPROOF SECURITY DEFINER >>> COST 100.0 >>> AS >>> >>> BEGIN >>> b:=a+b+1; >>> END; >>> >>> COMMENT ON PROCEDURE public.foo >>> IS 'Foo procedure'; >>> ----- >>> >>> ----- >>> 2016-03-23 11:22:02,186: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >>> 11:22:02] "GET /browser/procedure/obj/1/2/14844/13627/16387 HTTP/1.1" >>> 500 - >>> Traceback (most recent call last): >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1836, in __call__ >>> return self.wsgi_app(environ, start_response) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1820, in wsgi_app >>> response = self.make_response(self.handle_exception(e)) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1403, in handle_exception >>> reraise(exc_type, exc_value, tb) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1817, in wsgi_app >>> response = self.full_dispatch_request() >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1477, in full_dispatch_request >>> rv = self.handle_user_exception(e) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1381, in handle_user_exception >>> reraise(exc_type, exc_value, tb) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1475, in full_dispatch_request >>> rv = self.dispatch_request() >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1461, in dispatch_request >>> return self.view_functions[rule.endpoint](**req.view_args) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >>> line 84, in view >>> return self.dispatch_request(*args, **kwargs) >>> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >>> 233, in dispatch_request >>> return method(*args, **kwargs) >>> File >>> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >>> line 349, in wrap >>> return f(*args, **kwargs) >>> File >>> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >>> line 425, in properties >>> resp_data = self._fetch_properties(gid, sid, did, scid, fnid) >>> File >>> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >>> line 1097, in _fetch_properties >>> resp_data = res['rows'][0] >>> IndexError: list index out of range >>> ----- >>> >>> - After a Python server reset, I get the following error when trying >>> to view SQL of a Procedure (seems like it thinks it's connected to >>> PG?): >>> >>> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >>> 2016-03-23 11:28:52,852: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >>> 11:28:52] "GET /browser/procedure/nodes/1/2/14844/2200/ HTTP/1.1" 500 >>> - >>> Traceback (most recent call last): >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1836, in __call__ >>> return self.wsgi_app(environ, start_response) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1820, in wsgi_app >>> response = self.make_response(self.handle_exception(e)) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1403, in handle_exception >>> reraise(exc_type, exc_value, tb) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1817, in wsgi_app >>> response = self.full_dispatch_request() >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1477, in full_dispatch_request >>> rv = self.handle_user_exception(e) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1381, in handle_user_exception >>> reraise(exc_type, exc_value, tb) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1475, in full_dispatch_request >>> rv = self.dispatch_request() >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", >>> line 1461, in dispatch_request >>> return self.view_functions[rule.endpoint](**req.view_args) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", >>> line 84, in view >>> return self.dispatch_request(*args, **kwargs) >>> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line >>> 233, in dispatch_request >>> return method(*args, **kwargs) >>> File >>> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >>> line 349, in wrap >>> return f(*args, **kwargs) >>> File >>> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py", >>> line 390, in nodes >>> 'node.sql']), scid=scid) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >>> line 127, in render_template >>> return >>> _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >>> line 830, in get_or_select_template >>> return self.get_template(template_name_or_list, parent, globals) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >>> line 791, in get_template >>> return self._load_template(name, self.make_globals(globals)) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/environment.py", >>> line 765, in _load_template >>> template = self.loader.load(self, name, globals) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/jinja2/loaders.py", >>> line 113, in load >>> source, filename, uptodate = self.get_source(environment, name) >>> File >>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/templating.py", >>> line 64, in get_source >>> raise TemplateNotFound(template) >>> TemplateNotFound: procedure/pg/sql/9.5_plus/node.sql >>> 2016-03-23 11:28:57,953: INFO werkzeug: 127.0.0.1 - - [23/Mar/2016 >>> 11:28:57] "POST /ping HTTP/1.1" 200 - >>> >> Done >>> >>> - Procedures do not include the schema name in the headers of reverse >>> engineered SQL, e.g. >>> >> Done >>> >>> - What's the trailing - in the parameter list in this reverse engineered >>> SQL? >>> >>> -- PROCEDURE: foo >>> >>> -- DROP PROCEDURE foo; >>> >>> CREATE OR REPLACE PROCEDURE public.foo(IN a integer DEFAULT 10, INOUT >>> b integer DEFAULT -) >>> VOLATILE NOT LEAKPROOF SECURITY DEFINER >>> COST 100.0 >>> AS >>> >>> BEGIN >>> b:=a+b+1; >>> END; >>> >>> COMMENT ON PROCEDURE public.foo >>> IS 'Foo procedure'; >>> >> Done >>> >>> Thanks! >>> >>> -- >>> Dave Page >>> Blog: http://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EnterpriseDB UK: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >> >> > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > > -- > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers -- Thom
Вложения
On Tue, Apr 5, 2016 at 5:18 PM, Thom Brown <thom@linux.com> wrote: > I'm getting weirdness with this node. See the attached picture, where > it shows the servers node appearing under functions. Make sure you've restarted the python server, and do a hard-refresh in your browser. That normally clears that issue up for me. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On 5 April 2016 at 17:20, Dave Page <dpage@pgadmin.org> wrote: > On Tue, Apr 5, 2016 at 5:18 PM, Thom Brown <thom@linux.com> wrote: >> I'm getting weirdness with this node. See the attached picture, where >> it shows the servers node appearing under functions. > > Make sure you've restarted the python server, and do a hard-refresh in > your browser. That normally clears that issue up for me. I restarted python, but the hard refresh in the browser worked. Thanks! Thom