Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/PGPRO-8877'
Browse files Browse the repository at this point in the history
Conflicts:
	compat.h

Caused by:
- 22212ba (PGPRO-8877)
  PostgreSQL 17 support.
- ed9f977 (master)
  Drop support for Postgres < 12
  • Loading branch information
Marina Polyakova committed Jul 18, 2024
2 parents 8eaa130 + 22212ba commit b79a816
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ pgws_collector_main(Datum main_arg)
pqsignal(SIGTERM, handle_sigterm);
pqsignal(SIGUSR1, procsignal_sigusr1_handler);
BackgroundWorkerUnblockSignals();
InitPostgresCompat(NULL, InvalidOid, NULL, InvalidOid, false, false, NULL);
InitPostgresCompat(NULL, InvalidOid, NULL, InvalidOid, 0, NULL);
SetProcessingMode(NormalProcessing);

/* Make pg_wait_sampling recognisable in pg_stat_activity */
Expand Down
18 changes: 11 additions & 7 deletions compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,26 @@ shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
#endif
}

#if PG_VERSION_NUM < 170000
#define INIT_PG_LOAD_SESSION_LIBS 0x0001
#define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
#endif

static inline void
InitPostgresCompat(const char *in_dbname, Oid dboid,
const char *username, Oid useroid,
bool load_session_libraries,
bool override_allow_connections,
bits32 flags,
char *out_dbname)
{
#if PG_VERSION_NUM >= 170000
InitPostgres(in_dbname, dboid, username, useroid, (load_session_libraries ? INIT_PG_LOAD_SESSION_LIBS : 0) |
(override_allow_connections ? INIT_PG_OVERRIDE_ALLOW_CONNS : 0), out_dbname);
InitPostgres(in_dbname, dboid, username, useroid, flags, out_dbname);
#elif PG_VERSION_NUM >= 150000
InitPostgres(in_dbname, dboid, username, useroid, load_session_libraries,
override_allow_connections, out_dbname);
InitPostgres(in_dbname, dboid, username, useroid,
flags & INIT_PG_LOAD_SESSION_LIBS,
flags & INIT_PG_OVERRIDE_ALLOW_CONNS, out_dbname);
#else
InitPostgres(in_dbname, dboid, username, useroid, out_dbname,
override_allow_connections);
flags & INIT_PG_OVERRIDE_ALLOW_CONNS);
#endif
}

Expand Down

0 comments on commit b79a816

Please sign in to comment.