public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch]: Error while expanding server group node.
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch]: Error while expanding server group node.
@ 2016-09-26 13:24  Surinder Kumar <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Surinder Kumar @ 2016-09-26 13:24 UTC (permalink / raw)
  To: pgadmin-hackers

Hi

*Issue:*
Getting following error while expanding server group node.
File
"/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/__init__.py",
line 86, in get_nodes
    in_recovery = result['rows'][0]['inrecovery'];
TypeError: string indices must be integers

Not a proper scenario to reproduce it.

*Solution:*
Add proper check to fix it.


-- 
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] server_expand_issue.patch (1.3K, 3-server_expand_issue.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 35494a2..a6fe620 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -71,6 +71,8 @@ class ServerModule(sg.ServerGroupPluginModule):
             manager = driver.connection_manager(server.id)
             conn = manager.connection()
             connected = conn.connected()
+            in_recovery = None
+            wal_paused = None
             if connected:
                 status, result = conn.execute_dict("""
                     SELECT CASE WHEN usesuper
@@ -83,11 +85,9 @@ class ServerModule(sg.ServerGroupPluginModule):
                            END as isreplaypaused
                     FROM pg_user WHERE usename=current_user""")
 
-                in_recovery = result['rows'][0]['inrecovery'];
-                wal_paused = result['rows'][0]['isreplaypaused']
-            else:
-                in_recovery = None
-                wal_paused = None
+                if len(result['rows']):
+                    in_recovery = result['rows'][0]['inrecovery']
+                    wal_paused = result['rows'][0]['isreplaypaused']
 
             yield self.generate_browser_node(
                 "%d" % (server.id),


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

* Re: [pgAdmin4][Patch]: Error while expanding server group node.
@ 2016-09-26 13:47  Ashesh Vashi <[email protected]>
  parent: Surinder Kumar <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Ashesh Vashi @ 2016-09-26 13:47 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers

On Mon, Sep 26, 2016 at 6:54 PM, Surinder Kumar <
[email protected]> wrote:

> Hi
>
> *Issue:*
> Getting following error while expanding server group node.
> File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/
> browser/server_groups/servers/__init__.py", line 86, in get_nodes
>     in_recovery = result['rows'][0]['inrecovery'];
> TypeError: string indices must be integers
>
> Not a proper scenario to reproduce it.
>
> *Solution:*
> Add proper check to fix it.
>

Thanks - committed!

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
<http://www.enterprisedb.com/;


*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi;


>
>
>
>
> --
> 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-26 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 13:24 [pgAdmin4][Patch]: Error while expanding server group node. Surinder Kumar <[email protected]>
2016-09-26 13:47 ` Ashesh Vashi <[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