public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: To fix the issue of Table node (pgAdmin4)
2+ messages / 2 participants
[nested] [flat]

* PATCH: To fix the issue of Table node (pgAdmin4)
@ 2016-09-13 08:03  Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Murtuza Zabuawala @ 2016-09-13 08:03 UTC (permalink / raw)
  To: pgadmin-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;
+}


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PATCH: To fix the issue of Table node (pgAdmin4)
@ 2016-09-14 09:43  Dave Page <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-09-14 09:43 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Tue, Sep 13, 2016 at 9:03 AM, Murtuza Zabuawala
<[email protected]> wrote:
> 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
>



-- 
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 ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-09-14 09:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 08:03 PATCH: To fix the issue of Table node (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-09-14 09:43 ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox