Hi,

I tried to write some patches for pgAdmin on the new features of 9.4.
First one is to support the two new columns of pg_stat_activity in
frmStatus.

Patch attached, comments welcome.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
>From 86c000d73b2fb4a6a87927a3ab35f9d92309f632 Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <[email protected]>
Date: Tue, 6 May 2014 21:40:19 +0200
Subject: [PATCH] Support the new columns in pg_stat_activity (new as in 9.4)

---
 pgadmin/frm/frmStatus.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pgadmin/frm/frmStatus.cpp b/pgadmin/frm/frmStatus.cpp
index 2a1c8a6..6c78fe8 100644
--- a/pgadmin/frm/frmStatus.cpp
+++ b/pgadmin/frm/frmStatus.cpp
@@ -587,6 +587,11 @@ void frmStatus::AddStatusPane()
 		statusList->AddColumn(_("State"), 35);
 		statusList->AddColumn(_("State change"), 35);
 	}
+	if (connection->BackendMinimumVersion(9, 4))
+	{
+		statusList->AddColumn(_("Backend XID"), 35);
+		statusList->AddColumn(_("Backend XMin"), 35);
+	}
 	statusList->AddColumn(_("Blocked by"), 35);
 	statusList->AddColumn(_("Query"), 500);
 
@@ -1381,6 +1386,10 @@ void frmStatus::OnRefreshStatusTimer(wxTimerEvent &event)
 	if (connection->BackendMinimumVersion(9, 2))
 		q += wxT("state, date_trunc('second', state_change) AS state_change, ");
 
+	// Xmin and XID
+	if (connection->BackendMinimumVersion(9, 4))
+		q += wxT("backend_xid::text, backend_xmin::text, ");
+
 	// Blocked by...
 	q +=   wxT("(SELECT min(l1.pid) FROM pg_locks l1 WHERE GRANTED AND (")
 	       wxT("relation IN (SELECT relation FROM pg_locks l2 WHERE l2.pid=") + pidcol + wxT(" AND NOT granted)")
@@ -1466,6 +1475,12 @@ void frmStatus::OnRefreshStatusTimer(wxTimerEvent &event)
 					statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("state_change")));
 				}
 
+				if (connection->BackendMinimumVersion(9, 4))
+				{
+					statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("backend_xid")));
+					statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("backend_xmin")));
+				}
+
 				statusList->SetItem(row, colpos++, dataSet1->GetVal(wxT("blockedby")));
 				statusList->SetItem(row, colpos, qry);
 
-- 
1.9.0

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

Reply via email to