public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: To fix the issue of Table node (pgAdmin4)
Date: Tue, 13 Sep 2016 13:33:42 +0530
Message-ID: <CAKKotZSnMC5iMMqwzS3CaRrRqRddvyjtd5-aQdJe-O7N8vhFGg@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA patch to fix the issue where code breaks when user tries to view data
on table which do not have any column(s).
RM#1677
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
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_1677.patch (2.7K, 3-RM_1677.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py
index 607d0ec..2c96dea 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -531,25 +531,28 @@ def fetch_pg_types(trans_id):
# List of oid for which we need type name from pg_type
oid = ''
- for col in session_obj['columns_info']:
- type_obj = session_obj['columns_info'][col]
- oid += str(type_obj['type_code']) + ','
-
- # Remove extra comma
- oid = oid[:-1]
- status, res = conn.execute_dict(
- """SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN ({0}) ORDER BY oid;
+ res = {}
+ if 'columns_info' in session_obj \
+ and session_obj['columns_info'] is not None:
+ for col in session_obj['columns_info']:
+ type_obj = session_obj['columns_info'][col]
+ oid += str(type_obj['type_code']) + ','
+
+ # Remove extra comma
+ oid = oid[:-1]
+ status, res = conn.execute_dict(
+ """SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN ({0}) ORDER BY oid;
""".format(oid))
- if status:
- # iterate through pg_types and update the type name in session object
- for record in res['rows']:
- for col in session_obj['columns_info']:
- type_obj = session_obj['columns_info'][col]
- if type_obj['type_code'] == record['oid']:
- type_obj['type_name'] = record['typname']
+ if status:
+ # iterate through pg_types and update the type name in session object
+ for record in res['rows']:
+ for col in session_obj['columns_info']:
+ type_obj = session_obj['columns_info'][col]
+ if type_obj['type_code'] == record['oid']:
+ type_obj['type_name'] = record['typname']
- update_session_grid_transaction(trans_id, session_obj)
+ update_session_grid_transaction(trans_id, session_obj)
else:
status = False
res = error_msg
diff --git a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
index 64833bd..deac360 100644
--- a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
+++ b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
@@ -407,3 +407,7 @@ input.editor-checkbox {
.grid-canvas .new_row.error, .grid-canvas .updated_row.error {
background: #e46b6b;
}
+
+#datagrid div.slick-header.ui-state-default {
+ background: #2c76b4;
+}
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: PATCH: To fix the issue of Table node (pgAdmin4)
In-Reply-To: <CAKKotZSnMC5iMMqwzS3CaRrRqRddvyjtd5-aQdJe-O7N8vhFGg@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