openbsd-ports/databases/pgadmin3/patches/patch-pgadmin_schema_pgServer_cpp
landry 9d021f0513 Add support for postgresql >= 10.
pgadmin3 is unsupported upstream and doesn't officially support
postgresql above 9.5, but pgadmin4 is a whole different monster, so keep
this one on life support. Tested against 10.5.

(note that there's a 1.22.2 release upstream)

Patch taken from https://bugs.debian.org/878295

ok sthen@ pea@ (MAINTAINER), also tested by Stefan Wollny
2018-10-25 07:32:43 +00:00

62 lines
2.6 KiB
Plaintext

$OpenBSD: patch-pgadmin_schema_pgServer_cpp,v 1.1 2018/10/25 07:32:44 landry Exp $
adapted from https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=878295;filename=postgresql_10.x_support.patch;msg=3
Index: pgadmin/schema/pgServer.cpp
--- pgadmin/schema/pgServer.cpp.orig
+++ pgadmin/schema/pgServer.cpp
@@ -905,13 +905,24 @@ int pgServer::Connect(frmMain *form, bool askPassword,
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"));
@@ -1434,7 +1445,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 +1457,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);
}