Subject: [pgAdmin4][PATCH] To fix the issue in server stats sql (PPAS9.2)

From: Murtuza Zabuawala <[email-masked]>
Date: Tue, 16 May 2017 21:13:09 +0530

Hi,

PFA minor patch to fix the in server stats sql where it was fails to
execute because it is not able to concat inet (type) when using with ||
operator.

*Fails:*
select client_addr || ':' || client_port from pg_stat_activity

*Works:*
select client_addr::text || ':' || client_port from pg_stat_activity

Fixes RM#1831

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
index 0b397f6..189db28 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
@@ -7,7 +7,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE
@@ -32,7 +32,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
index a1dbc37..99bf2f4 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
@@ -7,7 +7,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE
@@ -33,7 +33,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
index 54447ba..6255219 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
@@ -7,7 +7,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE
@@ -32,7 +32,7 @@ SELECT
     WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
         client_hostname || ':' || client_port
     WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-        client_addr || ':' || client_port
+        client_addr::text || ':' || client_port
     WHEN client_port = -1 THEN
         'local pipe'
     ELSE

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

---

From: Dave Page <[email-masked]>
Date: Wed, 17 May 2017 15:53:28 +0100

Thanks - patch applied.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company