Skip to content

Commit 22212ba

Browse files
committed
PostgreSQL 17 support.
Caused by: - 4800a5dfb4c46d22b5d05f16c615bea6ff24a2bb (PostgreSQL) Refactor InitPostgres() to use bitwise option flags
1 parent 92097fd commit 22212ba

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

collector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ pgws_collector_main(Datum main_arg)
351351
pqsignal(SIGTERM, handle_sigterm);
352352
pqsignal(SIGUSR1, procsignal_sigusr1_handler);
353353
BackgroundWorkerUnblockSignals();
354-
InitPostgresCompat(NULL, InvalidOid, NULL, InvalidOid, false, false, NULL);
354+
InitPostgresCompat(NULL, InvalidOid, NULL, InvalidOid, 0, NULL);
355355
SetProcessingMode(NormalProcessing);
356356

357357
/* Make pg_wait_sampling recognisable in pg_stat_activity */

compat.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,26 @@ shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
4848
#endif
4949
}
5050

51+
#if PG_VERSION_NUM < 170000
52+
#define INIT_PG_LOAD_SESSION_LIBS 0x0001
53+
#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
54+
#endif
55+
5156
static inline void
5257
InitPostgresCompat(const char *in_dbname, Oid dboid,
5358
const char *username, Oid useroid,
54-
bool load_session_libraries,
55-
bool override_allow_connections,
59+
bits32 flags,
5660
char *out_dbname)
5761
{
5862
#if PG_VERSION_NUM >= 170000
59-
InitPostgres(in_dbname, dboid, username, useroid, (load_session_libraries ? INIT_PG_LOAD_SESSION_LIBS : 0) |
60-
(override_allow_connections ? INIT_PG_OVERRIDE_ALLOW_CONNS : 0), out_dbname);
63+
InitPostgres(in_dbname, dboid, username, useroid, flags, out_dbname);
6164
#elif PG_VERSION_NUM >= 150000
62-
InitPostgres(in_dbname, dboid, username, useroid, load_session_libraries,
63-
override_allow_connections, out_dbname);
65+
InitPostgres(in_dbname, dboid, username, useroid,
66+
flags & INIT_PG_LOAD_SESSION_LIBS,
67+
flags & INIT_PG_OVERRIDE_ALLOW_CONNS, out_dbname);
6468
#elif PG_VERSION_NUM >= 110000
6569
InitPostgres(in_dbname, dboid, username, useroid, out_dbname,
66-
override_allow_connections);
70+
flags & INIT_PG_OVERRIDE_ALLOW_CONNS);
6771
#else
6872
InitPostgres(in_dbname, dboid, username, useroid, out_dbname);
6973
#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