- Add support for PostgreSQL 11 [2] - Fix query tool window crash [2] - Bump PORTREVISION PR: 236572, 238135 Submitted by: kirill@ironlogic.ru [2] Obtained from: Debian [1]
71 lines
3.4 KiB
Text
71 lines
3.4 KiB
Text
Authors: Bernhard Rieder <bernhard@ratte.cc>, Christoph Berg <myon@debian.org>
|
|
|
|
--- pgadmin/schema/pgServer.cpp
|
|
+++ pgadmin/schema/pgServer.cpp
|
|
@@ -905,13 +905,24 @@ int pgServer::Connect(frmMain *form, boo
|
|
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_receive_location() ELSE NULL END as receiveloc");
|
|
- sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_replay_location() ELSE NULL END as replayloc");
|
|
+ if (conn->BackendMinimumVersion(10, 0))
|
|
+ {
|
|
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_wal_receive_lsn() ELSE NULL END as receiveloc");
|
|
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_wal_replay_lsn() ELSE NULL END as replayloc");
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_receive_location() ELSE NULL END as receiveloc");
|
|
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_replay_location() ELSE NULL END as replayloc");
|
|
+ }
|
|
}
|
|
if (conn->BackendMinimumVersion(9, 1))
|
|
{
|
|
sql += wxT(", CASE WHEN usesuper THEN pg_last_xact_replay_timestamp() ELSE NULL END as replay_timestamp");
|
|
- sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_xlog_replay_paused() ELSE NULL END as isreplaypaused");
|
|
+ if (conn->BackendMinimumVersion(10, 0))
|
|
+ sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_wal_replay_paused() ELSE NULL END as isreplaypaused");
|
|
+ else
|
|
+ sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_xlog_replay_paused() ELSE NULL END as isreplaypaused");
|
|
}
|
|
|
|
pgSet *set = ExecuteSet(sql + wxT("\n FROM pg_user WHERE usename=current_user"));
|
|
@@ -1355,7 +1366,11 @@ void pgServer::ShowStatistics(frmMain *f
|
|
wxString pidcol = GetConnection()->BackendMinimumVersion(9, 2) ? wxT("pid") : wxT("procpid");
|
|
wxString querycol = GetConnection()->BackendMinimumVersion(9, 2) ? wxT("query") : wxT("current_query");
|
|
wxString sql;
|
|
- wxString replication_query = wxT("state || ' (' || sent_location || ' sent, ' || write_location || ' written, ' || flush_location || ' flushed, ' || replay_location || ' applied)'");
|
|
+ wxString replication_query;
|
|
+ if (conn->BackendMinimumVersion(10, 0))
|
|
+ replication_query = wxT("state || ' (' || sent_lsn || ' sent, ' || write_lsn || ' written, ' || flush_lsn || ' flushed, ' || replay_lsn || ' applied)'");
|
|
+ else
|
|
+ replication_query = wxT("state || ' (' || sent_location || ' sent, ' || write_location || ' written, ' || flush_location || ' flushed, ' || replay_location || ' applied)'");
|
|
wxLogInfo(wxT("Displaying statistics for server %s"), GetIdentifier().c_str());
|
|
|
|
// Add the statistics view columns
|
|
@@ -1434,7 +1449,11 @@ bool pgServer::ReloadConfiguration()
|
|
bool pgServer::PauseReplay()
|
|
{
|
|
SetReplayPaused(true);
|
|
- wxString sql = wxT("SELECT pg_xlog_replay_pause()");
|
|
+ wxString sql;
|
|
+ if (conn->BackendMinimumVersion(10, 0))
|
|
+ sql = wxT("SELECT pg_wal_replay_pause()");
|
|
+ else
|
|
+ sql = wxT("SELECT pg_xlog_replay_pause()");
|
|
return conn->ExecuteVoid(sql);
|
|
}
|
|
|
|
@@ -1442,7 +1461,11 @@ bool pgServer::PauseReplay()
|
|
bool pgServer::ResumeReplay()
|
|
{
|
|
SetReplayPaused(false);
|
|
- wxString sql = wxT("SELECT pg_xlog_replay_resume()");
|
|
+ wxString sql;
|
|
+ if (conn->BackendMinimumVersion(10, 0))
|
|
+ sql = wxT("SELECT pg_wal_replay_resume()");
|
|
+ else
|
|
+ sql = wxT("SELECT pg_xlog_replay_resume()");
|
|
return conn->ExecuteVoid(sql);
|
|
}
|
|
|