public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: Fixed RM 2381 - "Create Script" for view assigns incorrect schema to trigger functions in "public" schema.
Date: Mon, 5 Jun 2017 15:56:21 +0530
Message-ID: <CAFOhELf3boyf=V7_yhGkTv11y2nmZeitWS6ZG-jiJX9R69YEKQ@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Please find the attached patch to fix RM 2381: "Create Script" for view
assigns incorrect schema to trigger functions in "public" schema.
Fixed the trigger function schema name in the view SQL tab.
Thanks,
Khushboo
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] RM_2381.patch (1.9K, 3-RM_2381.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 836018b..17a7df6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -896,15 +896,26 @@ class ViewNode(PGChildNodeView, VacuumSettings):
trigger['oid'], columns)
res_rows = trigger_definition(res_rows)
- res_rows['schema'] = res_rows['nspname']
-
# It should be relname and not table, but in create.sql
# (which is referred from many places) we have used
# data.table and not data.relname so compatibility add new key as
# table in res_rows.
res_rows['table'] = res_rows['relname']
- res_rows['tfunction'] = self.qtIdent(self.conn, res_rows['schema'], res_rows['tfunction'])
+ # Get trigger function with its schema name
+ SQL = render_template("/".join([self.trigger_temp_path,
+ 'sql/#{0}#/get_triggerfunctions.sql'.format(self.manager.version)]),
+ tgfoid=res_rows['tgfoid'],
+ show_system_objects=self.blueprint.show_system_objects)
+
+ status, result = self.conn.execute_dict(SQL)
+ if not status:
+ return internal_server_error(errormsg=result)
+
+ # Update the trigger function which we have fetched with schema name
+ if 'rows' in result and len(result['rows']) > 0 and \
+ 'tfunctions' in result['rows'][0]:
+ res_rows['tfunction'] = result['rows'][0]['tfunctions']
# Format arguments
if len(res_rows['custom_tgargs']) > 1:
view thread (2+ 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]: Fixed RM 2381 - "Create Script" for view assigns incorrect schema to trigger functions in "public" schema.
In-Reply-To: <CAFOhELf3boyf=V7_yhGkTv11y2nmZeitWS6ZG-jiJX9R69YEKQ@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