Hi,
I tried both of them yesterday night and tonight to have a look at what
could be done on pgAdmin for these features. AFAICT, not a lot.
Actually, I have a really small patch that adds some informations in the
server panel. This information is quite simple. It tells the user if the
selected server is in recovery mode and the last xlog replay location.
I'm not sure we can do more. Streaming Replication can be detected if
max_wal_senders is greater than zero, but I'm not sure we really need to
add this kind of information on the server panel.
If we want to got a bit further, the only idea I had was to allow the
user to see objects' properties but deny to change them. We can also
deny the use of the maintenance window and the restore one. As we don't
already do that when a user doesn't have the priviledge to do so, I
suppose we won't do that. At least for this release. I'm really
interested to implement this in a future release.
Any comments? on the patch and on this "idea".
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
diff --git a/pgadmin/include/schema/pgServer.h b/pgadmin/include/schema/pgServer.h
index 013a5c6..73944be 100644
--- a/pgadmin/include/schema/pgServer.h
+++ b/pgadmin/include/schema/pgServer.h
@@ -81,6 +81,13 @@ public:
bool GetCreateRole() const { return createRole; }
void iSetCreateRole(const bool b) { createRole=b; }
+ bool GetInRecovery() const { return inRecovery; }
+ void iSetInRecovery(const bool b) { inRecovery=b; }
+ wxDateTime GetConfLoadedSince() { return confLoadedSince; }
+ void iSetConfLoadedSince(const wxDateTime &d) { confLoadedSince = d; }
+ wxString GetReplayLoc() const { return replayLoc; }
+ void iSetReplayLoc(const wxString& s) { replayLoc=s; }
+
pgConn *CreateConn(wxString dbName=wxEmptyString, OID oid=0, wxString applicationname=wxEmptyString);
wxString GetLastDatabase() const { return lastDatabase; }
@@ -154,6 +161,10 @@ private:
wxString dbRestriction;
wxString colour;
+ bool inRecovery;
+ wxString replayLoc;
+ wxDateTime confLoadedSince;
+
#ifdef WIN32
SC_HANDLE scmHandle;
SC_HANDLE serviceHandle;
diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp
index 27e884f..3be3ff1 100644
--- a/pgadmin/schema/pgServer.cpp
+++ b/pgadmin/schema/pgServer.cpp
@@ -663,6 +663,15 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
hasUptime=true;
sql += wxT(", CASE WHEN usesuper THEN pg_postmaster_starttime() ELSE NULL END as upsince");
}
+ if (conn->BackendMinimumVersion(8, 4))
+ {
+ sql += wxT(", CASE WHEN usesuper THEN pg_conf_load_time() ELSE NULL END as confloadedsince");
+ }
+ if (conn->BackendMinimumVersion(8, 5))
+ {
+ sql += wxT(", CASE WHEN usesuper THEN pg_is_in_recovery() ELSE NULL END as inrecovery");
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_replay_location() ELSE NULL END as replayloc");
+ }
pgSet *set=ExecuteSet(sql + wxT("\n FROM pg_user WHERE usename=current_user"));
if (set)
@@ -671,6 +680,13 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
iSetSuperUser(set->GetBool(wxT("usesuper")));
if (hasUptime)
iSetUpSince(set->GetDateTime(wxT("upsince")));
+ if (conn->BackendMinimumVersion(8, 4))
+ iSetConfLoadedSince(set->GetDateTime(wxT("confloadedsince")));
+ if (conn->BackendMinimumVersion(8, 5))
+ {
+ iSetInRecovery(set->GetBool(wxT("inrecovery")));
+ iSetReplayLoc(set->GetVal(wxT("replayloc")));
+ }
delete set;
}
@@ -956,8 +972,15 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
{
if (GetUpSince().IsValid())
properties->AppendItem(_("Up since"), GetUpSince());
+ if (GetConfLoadedSince().IsValid())
+ properties->AppendItem(_("Configuration loaded since"), GetConfLoadedSince());
if (conn->BackendMinimumVersion(8,1))
properties->AppendItem(wxT("Autovacuum"), (autovacuumRunning ? _("running") : _("not running")));
+ if (conn->BackendMinimumVersion(8,5))
+ {
+ properties->AppendItem(wxT("In recovery"), (GetInRecovery() ? _("yes") : _("no")));
+ properties->AppendItem(wxT("Last XLOG replay location"), GetReplayLoc());
+ }
}
if (GetServerControllable())
properties->AppendItem(_("Running?"), GetServerRunning());
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers