Re: [pgadmin-hackers] PATCH: Fixed sql execution issue (pgAdmin4)

2016-05-12 Thread Ashesh Vashi
Thanks - committed!


--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company



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


On Thu, May 12, 2016 at 1:18 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to fixed the issue which was introduced with "Named restore
> point" functionality in get_nodes function.
>
> Issue: SQL was getting executed without checking database connection
> causing invalid node status.
>
>
> Thanks to Khushboo for reporting the issue.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: 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
>
>


[pgadmin-hackers] PATCH: Fixed sql execution issue (pgAdmin4)

2016-05-12 Thread Murtuza Zabuawala
Hi,

PFA patch to fixed the issue which was introduced with "Named restore
point" functionality in get_nodes function.

Issue: SQL was getting executed without checking database connection
causing invalid node status.


Thanks to Khushboo for reporting the issue.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 180807f..a79f1d4 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -69,13 +69,15 @@ class ServerModule(sg.ServerGroupPluginModule):
 manager = driver.connection_manager(server.id)
 conn = manager.connection()
 connected = conn.connected()
-
-status, in_recovery = conn.execute_scalar("""
-SELECT CASE WHEN usesuper
-   THEN pg_is_in_recovery()
-   ELSE FALSE
-   END as inrecovery
-FROM pg_user WHERE usename=current_user""")
+if connected:
+status, in_recovery = conn.execute_scalar("""
+SELECT CASE WHEN usesuper
+   THEN pg_is_in_recovery()
+   ELSE FALSE
+   END as inrecovery
+FROM pg_user WHERE usename=current_user""")
+else:
+in_recovery = None
 
 yield self.generate_browser_node(
 "%d" % (server.id),

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers