Line 0
Link Here
|
|
|
1 |
--- pgadmin/schema/pgFunction.cpp.orig 2019-05-24 16:47:20.205020000 +0300 |
2 |
+++ pgadmin/schema/pgFunction.cpp 2019-05-24 16:56:08.010511000 +0300 |
3 |
@@ -787,7 +787,18 @@ |
4 |
function->iSetArgDefValCount(functions->GetLong(wxT("pronargdefaults"))); |
5 |
|
6 |
// Check if it is a window function |
7 |
- function->iSetIsWindow(functions->GetBool(wxT("proiswindow"))); |
8 |
+// function->iSetIsWindow(functions->GetBool(wxT("proiswindow"))); |
9 |
+ bool isWindow = false; |
10 |
+ if (obj->GetConnection()->BackendMinimumVersion(11, 0)) |
11 |
+ { |
12 |
+ char* c = functions->GetCharPtr(wxT("prokind")); |
13 |
+ isWindow = c!=NULL && *c=='w'; |
14 |
+ } |
15 |
+ else |
16 |
+ { |
17 |
+ isWindow = functions->GetBool(wxT("proiswindow")); |
18 |
+ } |
19 |
+ function->iSetIsWindow(isWindow); |
20 |
} |
21 |
else |
22 |
function->iSetIsWindow(false); |
23 |
@@ -1060,10 +1071,17 @@ |
24 |
|
25 |
pgObject *pgFunctionFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restr) |
26 |
{ |
27 |
- wxString funcRestriction = wxT( |
28 |
- " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
29 |
- + wxT("::oid\n AND typname NOT IN ('trigger', 'event_trigger') \n"); |
30 |
+// wxString funcRestriction = wxT( |
31 |
+// " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
32 |
+// + wxT("::oid\n AND typname NOT IN ('trigger', 'event_trigger') \n"); |
33 |
|
34 |
+ wxString funcRestriction = wxString::Format( wxT(" WHERE %s AND pronamespace = %lu::oid\n AND typname NOT IN ('trigger', 'event_trigger') \n"), |
35 |
+ collection->GetConnection()->BackendMinimumVersion(11, 0) ? wxT(" pr.prokind!='a'") : wxT(" proisagg = FALSE"), |
36 |
+ collection->GetSchema()->GetOid() |
37 |
+ ); |
38 |
+ |
39 |
+ |
40 |
+ |
41 |
if (collection->GetConnection()->EdbMinimumVersion(8, 1)) |
42 |
funcRestriction += wxT(" AND NOT (lanname = 'edbspl' AND protype = '1')\n"); |
43 |
else if (collection->GetConnection()->EdbMinimumVersion(8, 0)) |
44 |
@@ -1081,9 +1099,16 @@ |
45 |
|
46 |
pgObject *pgTriggerFunctionFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restr) |
47 |
{ |
48 |
- wxString funcRestriction = wxT( |
49 |
- " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
50 |
- + wxT("::oid\n"); |
51 |
+// wxString funcRestriction = wxT( |
52 |
+// " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
53 |
+// + wxT("::oid\n"); |
54 |
+ |
55 |
+ wxString funcRestriction = wxString::Format( wxT(" WHERE %s AND pronamespace = %lu::oid\n"), |
56 |
+ collection->GetConnection()->BackendMinimumVersion(11, 0) ? wxT(" pr.prokind!='a'") : wxT(" proisagg = FALSE"), |
57 |
+ collection->GetSchema()->GetOid() |
58 |
+ ); |
59 |
+ |
60 |
+ |
61 |
if(collection->GetConnection()->BackendMinimumVersion(9, 3)) |
62 |
{ |
63 |
funcRestriction += wxT("AND (typname IN ('trigger', 'event_trigger') \nAND lanname NOT IN ('edbspl', 'sql', 'internal'))"); |
64 |
@@ -1100,9 +1125,14 @@ |
65 |
|
66 |
pgObject *pgProcedureFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restr) |
67 |
{ |
68 |
- wxString funcRestriction = wxT( |
69 |
- " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
70 |
- + wxT("::oid AND lanname = 'edbspl'\n"); |
71 |
+// wxString funcRestriction = wxT( |
72 |
+// " WHERE proisagg = FALSE AND pronamespace = ") + NumToStr(collection->GetSchema()->GetOid()) |
73 |
+// + wxT("::oid AND lanname = 'edbspl'\n"); |
74 |
+ |
75 |
+ wxString funcRestriction = wxString::Format( wxT(" WHERE %s AND pronamespace = %lu::oid AND lanname = 'edbspl'\n"), |
76 |
+ collection->GetConnection()->BackendMinimumVersion(11, 0) ? wxT(" pr.prokind!='a'") : wxT(" proisagg = FALSE"), |
77 |
+ collection->GetSchema()->GetOid() |
78 |
+ ); |
79 |
|
80 |
if (collection->GetConnection()->EdbMinimumVersion(8, 1)) |
81 |
funcRestriction += wxT(" AND protype = '1'\n"); |
82 |
--- pgadmin/include/pgAdmin3.h.orig 2019-05-24 16:57:48.604781000 +0300 |
83 |
+++ pgadmin/include/pgAdmin3.h 2019-05-24 16:58:19.307701000 +0300 |
84 |
@@ -58,8 +58,8 @@ |
85 |
// Supported server minimum and maximum values. |
86 |
const short SERVER_MIN_VERSION_N = 0x0804; |
87 |
const wxString SERVER_MIN_VERSION_T = wxT("8.4"); |
88 |
-const short SERVER_MAX_VERSION_N = 0x0906; |
89 |
-const wxString SERVER_MAX_VERSION_T = wxT("9.6"); |
90 |
+const short SERVER_MAX_VERSION_N = 0x0B03; |
91 |
+const wxString SERVER_MAX_VERSION_T = wxT("11.3"); |
92 |
|
93 |
// Supported Greenplum Database and Greenplum HAWQ minimum and maximum values. |
94 |
const short GP_MIN_VERSION_N = 0x0802; |
95 |
--- pgadmin/schema/pgServer.cpp.orig 2019-05-24 16:59:24.102130000 +0300 |
96 |
+++ pgadmin/schema/pgServer.cpp 2019-05-24 17:10:41.077826000 +0300 |
97 |
@@ -886,8 +886,16 @@ |
98 |
|
99 |
connected = true; |
100 |
bool hasUptime = false; |
101 |
+ bool is10plus = false; |
102 |
|
103 |
wxString sql = wxT("SELECT usecreatedb, usesuper"); |
104 |
+ |
105 |
+ if (conn->BackendMinimumVersion(10, 0)) |
106 |
+ { |
107 |
+ is10plus = true; |
108 |
+ } |
109 |
+ |
110 |
+ |
111 |
if (conn->BackendMinimumVersion(8, 1)) |
112 |
{ |
113 |
hasUptime = true; |
114 |
@@ -905,13 +913,30 @@ |
115 |
if (conn->BackendMinimumVersion(8, 5)) |
116 |
{ |
117 |
sql += wxT(", CASE WHEN usesuper THEN pg_is_in_recovery() ELSE NULL END as inrecovery"); |
118 |
- sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_receive_location() ELSE NULL END as receiveloc"); |
119 |
- sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_replay_location() ELSE NULL END as replayloc"); |
120 |
+ if (is10plus) |
121 |
+ { |
122 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_wal_receive_lsn() ELSE NULL END as receiveloc"); |
123 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_wal_replay_lsn() ELSE NULL END as replayloc"); |
124 |
+ } |
125 |
+ else |
126 |
+ { |
127 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_receive_location() ELSE NULL END as receiveloc"); |
128 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xlog_replay_location() ELSE NULL END as replayloc"); |
129 |
+ } |
130 |
} |
131 |
if (conn->BackendMinimumVersion(9, 1)) |
132 |
{ |
133 |
- sql += wxT(", CASE WHEN usesuper THEN pg_last_xact_replay_timestamp() ELSE NULL END as replay_timestamp"); |
134 |
- sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_xlog_replay_paused() ELSE NULL END as isreplaypaused"); |
135 |
+ if (is10plus) |
136 |
+ { |
137 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xact_replay_timestamp() ELSE NULL END as replay_timestamp"); |
138 |
+ sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_wal_replay_paused() ELSE NULL END as isreplaypaused"); |
139 |
+ |
140 |
+ } |
141 |
+ else |
142 |
+ { |
143 |
+ sql += wxT(", CASE WHEN usesuper THEN pg_last_xact_replay_timestamp() ELSE NULL END as replay_timestamp"); |
144 |
+ sql += wxT(", CASE WHEN usesuper AND pg_is_in_recovery() THEN pg_is_xlog_replay_paused() ELSE NULL END as isreplaypaused"); |
145 |
+ } |
146 |
} |
147 |
|
148 |
pgSet *set = ExecuteSet(sql + wxT("\n FROM pg_user WHERE usename=current_user")); |
149 |
@@ -1262,8 +1287,8 @@ |
150 |
if (conn->BackendMinimumVersion(8, 5)) |
151 |
{ |
152 |
properties->AppendItem(_("In recovery"), (GetInRecovery() ? _("yes") : _("no"))); |
153 |
- properties->AppendItem(_("Last XLOG receive location"), GetReceiveLoc()); |
154 |
- properties->AppendItem(_("Last XLOG replay location"), GetReplayLoc()); |
155 |
+ properties->AppendItem(_("Last XLOG/WAL receive location"), GetReceiveLoc()); |
156 |
+ properties->AppendItem(_("Last XLOG/WAL replay location"), GetReplayLoc()); |
157 |
} |
158 |
if (conn->BackendMinimumVersion(9, 1)) |
159 |
{ |
160 |
@@ -1355,7 +1380,17 @@ |
161 |
wxString pidcol = GetConnection()->BackendMinimumVersion(9, 2) ? wxT("pid") : wxT("procpid"); |
162 |
wxString querycol = GetConnection()->BackendMinimumVersion(9, 2) ? wxT("query") : wxT("current_query"); |
163 |
wxString sql; |
164 |
- wxString replication_query = wxT("state || ' (' || sent_location || ' sent, ' || write_location || ' written, ' || flush_location || ' flushed, ' || replay_location || ' applied)'"); |
165 |
+ |
166 |
+ wxString replication_query; |
167 |
+ if (GetConnection()->BackendMinimumVersion(10, 0)) |
168 |
+ { |
169 |
+ replication_query = wxT("state || ' (' || sent_lsn || ' sent, ' || write_lsn || ' written, ' || flush_lsn || ' flushed, ' || replay_lsn || ' applied)'"); |
170 |
+ } |
171 |
+ else |
172 |
+ { |
173 |
+ replication_query = wxT("state || ' (' || sent_location || ' sent, ' || write_location || ' written, ' || flush_location || ' flushed, ' || replay_location || ' applied)'"); |
174 |
+ } |
175 |
+ |
176 |
wxLogInfo(wxT("Displaying statistics for server %s"), GetIdentifier().c_str()); |
177 |
|
178 |
// Add the statistics view columns |
179 |
@@ -1434,7 +1469,15 @@ |
180 |
bool pgServer::PauseReplay() |
181 |
{ |
182 |
SetReplayPaused(true); |
183 |
- wxString sql = wxT("SELECT pg_xlog_replay_pause()"); |
184 |
+ wxString sql; |
185 |
+ if (conn->BackendMinimumVersion(10, 0)) |
186 |
+ { |
187 |
+ sql = wxT("SELECT pg_wal_replay_pause()"); |
188 |
+ } |
189 |
+ else |
190 |
+ { |
191 |
+ sql = wxT("SELECT pg_xlog_replay_pause()"); |
192 |
+ } |
193 |
return conn->ExecuteVoid(sql); |
194 |
} |
195 |
|
196 |
@@ -1442,7 +1485,15 @@ |
197 |
bool pgServer::ResumeReplay() |
198 |
{ |
199 |
SetReplayPaused(false); |
200 |
- wxString sql = wxT("SELECT pg_xlog_replay_resume()"); |
201 |
+ wxString sql; |
202 |
+ if (conn->BackendMinimumVersion(10, 0)) |
203 |
+ { |
204 |
+ sql = wxT("SELECT pg_wal_replay_resume()"); |
205 |
+ } |
206 |
+ else |
207 |
+ { |
208 |
+ sql = wxT("SELECT pg_xlog_replay_resume()"); |
209 |
+ } |
210 |
return conn->ExecuteVoid(sql); |
211 |
} |
212 |
|