Skip to content

Commit f7fa45c

Browse files
authored
Fix Postgres 14 beta2 incompatibility. (#739)
The Process Utility Hook signature has changed in beta2, we need to adjust to the new signature for those versions.
1 parent 1083b83 commit f7fa45c

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

src/monitor/pg_auto_failover.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,25 @@ ProcessUtility_hook_type PreviousProcessUtility_hook = NULL;
4040

4141
void _PG_init(void);
4242
static void StartMonitorNode(void);
43+
44+
#if (PG_VERSION_NUM < 140000)
4345
static void pgautofailover_ProcessUtility(PlannedStmt *pstmt,
4446
const char *queryString,
4547
ProcessUtilityContext context,
4648
ParamListInfo params,
4749
struct QueryEnvironment *queryEnv,
4850
DestReceiver *dest,
4951
QueryCompletion *completionTag);
50-
52+
#else
53+
static void pgautofailover_ProcessUtility(PlannedStmt *pstmt,
54+
const char *queryString,
55+
bool readOnlyTree,
56+
ProcessUtilityContext context,
57+
ParamListInfo params,
58+
struct QueryEnvironment *queryEnv,
59+
DestReceiver *dest,
60+
QueryCompletion *completionTag);
61+
#endif
5162

5263
PG_MODULE_MAGIC;
5364

@@ -162,6 +173,7 @@ StartMonitorNode(void)
162173
* executed. As long as the background worker is connected, the DROP DATABASE
163174
* command would otherwise fail to complete.
164175
*/
176+
#if (PG_VERSION_NUM < 140000)
165177
void
166178
pgautofailover_ProcessUtility(PlannedStmt *pstmt,
167179
const char *queryString,
@@ -170,6 +182,17 @@ pgautofailover_ProcessUtility(PlannedStmt *pstmt,
170182
struct QueryEnvironment *queryEnv,
171183
DestReceiver *dest,
172184
QueryCompletion *completionTag)
185+
#else
186+
void
187+
pgautofailover_ProcessUtility(PlannedStmt * pstmt,
188+
const char * queryString,
189+
bool readOnlyTree,
190+
ProcessUtilityContext context,
191+
ParamListInfo params,
192+
struct QueryEnvironment *queryEnv,
193+
DestReceiver * dest,
194+
QueryCompletion * completionTag)
195+
#endif
173196
{
174197
Node *parsetree = pstmt->utilityStmt;
175198

@@ -191,12 +214,22 @@ pgautofailover_ProcessUtility(PlannedStmt *pstmt,
191214

192215
if (PreviousProcessUtility_hook)
193216
{
217+
#if (PG_VERSION_NUM < 140000)
194218
PreviousProcessUtility_hook(pstmt, queryString, context,
195219
params, queryEnv, dest, completionTag);
220+
#else
221+
PreviousProcessUtility_hook(pstmt, queryString, readOnlyTree, context,
222+
params, queryEnv, dest, completionTag);
223+
#endif
196224
}
197225
else
198226
{
227+
#if (PG_VERSION_NUM < 140000)
199228
standard_ProcessUtility(pstmt, queryString, context,
200229
params, queryEnv, dest, completionTag);
230+
#else
231+
standard_ProcessUtility(pstmt, queryString, readOnlyTree, context,
232+
params, queryEnv, dest, completionTag);
233+
#endif
201234
}
202235
}

0 commit comments

Comments
 (0)