Skip to content

Commit 81c641f

Browse files
RekGRpthSergey Shinderuk
authored andcommitted
PostgreSQL 15 support.
Pass extra argument to InitPostgres as per upstream commit 31ed3cf746a.
1 parent df1aa39 commit 81c641f

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

collector.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,7 @@ collector_main(Datum main_arg)
350350
pqsignal(SIGTERM, handle_sigterm);
351351
pqsignal(SIGUSR1, procsignal_sigusr1_handler);
352352
BackgroundWorkerUnblockSignals();
353-
354-
#if PG_VERSION_NUM >= 110000
355-
InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL, false);
356-
#else
357-
InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL);
358-
#endif
353+
InitPostgresCompat(NULL, InvalidOid, NULL, InvalidOid, false, false, NULL);
359354
SetProcessingMode(NormalProcessing);
360355

361356
/* Make pg_wait_sampling recognisable in pg_stat_activity */

compat.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "postgres.h"
2+
23
#include "access/tupdesc.h"
4+
#include "miscadmin.h"
35

46
#include "pg_wait_sampling.h"
57

@@ -33,3 +35,21 @@ CreateTemplateTupleDescCompat(int nattrs, bool hasoid)
3335
return CreateTemplateTupleDesc(nattrs, hasoid);
3436
#endif
3537
}
38+
39+
inline void
40+
InitPostgresCompat(const char *in_dbname, Oid dboid,
41+
const char *username, Oid useroid,
42+
bool load_session_libraries,
43+
bool override_allow_connections,
44+
char *out_dbname)
45+
{
46+
#if PG_VERSION_NUM >= 150000
47+
InitPostgres(in_dbname, dboid, username, useroid, load_session_libraries,
48+
override_allow_connections, out_dbname);
49+
#elif PG_VERSION_NUM >= 110000
50+
InitPostgres(in_dbname, dboid, username, useroid, out_dbname,
51+
override_allow_connections);
52+
#else
53+
InitPostgres(in_dbname, dboid, username, useroid, out_dbname);
54+
#endif
55+
}

pg_wait_sampling.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,10 @@ extern shm_mq_result shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes,
8888
const void *data, bool nowait,
8989
bool force_flush);
9090
extern TupleDesc CreateTemplateTupleDescCompat(int nattrs, bool hasoid);
91+
extern void InitPostgresCompat(const char *in_dbname, Oid dboid,
92+
const char *username, Oid useroid,
93+
bool load_session_libraries,
94+
bool override_allow_connections,
95+
char *out_dbname);
9196

9297
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy