Skip to content

Commit

Permalink
Make PG14 work
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Feb 8, 2025
1 parent 892f6c7 commit 8895ca0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pgduckdb_background_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ force_motherduck_sync(PG_FUNCTION_ARGS) {
}

namespace pgduckdb {
#if PG_VERSION_NUM >= 150000
static shmem_request_hook_type prev_shmem_request_hook = NULL;
#endif
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;

/*
Expand All @@ -178,8 +180,10 @@ static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
*/
static void
ShmemRequest(void) {
#if PG_VERSION_NUM >= 150000
if (prev_shmem_request_hook)
prev_shmem_request_hook();
#endif

RequestAddinShmemSpace(sizeof(BackgoundWorkerShmemStruct));
}
Expand Down Expand Up @@ -237,8 +241,12 @@ InitBackgroundWorker(void) {
RegisterBackgroundWorker(&worker);

/* Set up the shared memory hooks */
#if PG_VERSION_NUM >= 150000
prev_shmem_request_hook = shmem_request_hook;
shmem_request_hook = ShmemRequest;
#else
ShmemRequest();
#endif
prev_shmem_startup_hook = shmem_startup_hook;
shmem_startup_hook = ShmemStartup;
}
Expand Down

0 comments on commit 8895ca0

Please sign in to comment.