diff --git a/src/backup.c b/src/backup.c index add001a7..3cbd4fbf 100644 --- a/src/backup.c +++ b/src/backup.c @@ -2518,11 +2518,16 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno) int segno; pgFile **file_item; pgFile f; +#if PG_VERSION_NUM >= 180000 + RelPathStr rel_path_str = relpathperm(rnode, forknum); + rel_path = rel_path_str.str; +#else + rel_path = relpathperm(rnode, forknum); +#endif segno = blkno / RELSEG_SIZE; blkno_inseg = blkno % RELSEG_SIZE; - rel_path = relpathperm(rnode, forknum); if (segno > 0) f.rel_path = psprintf("%s.%u", rel_path, segno); else @@ -2554,7 +2559,9 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno) if (segno > 0) pg_free(f.rel_path); +#if PG_VERSION_NUM < 180000 pg_free(rel_path); +#endif } diff --git a/src/stream.c b/src/stream.c index 25429f9a..f136ed15 100644 --- a/src/stream.c +++ b/src/stream.c @@ -188,7 +188,11 @@ CreateReplicationSlot_compat(PGconn *conn, const char *slot_name, const char *pl bool is_temporary, bool is_physical, bool slot_exists_ok) { -#if PG_VERSION_NUM >= 150000 +#if PG_VERSION_NUM >= 180000 + return CreateReplicationSlot(conn, slot_name, plugin, is_temporary, is_physical, + /* reserve_wal = */ true, slot_exists_ok, /* two_phase = */ false, /* failover = */ false); +#elif PG_VERSION_NUM >= 150000 + return CreateReplicationSlot(conn, slot_name, plugin, is_temporary, is_physical, /* reserve_wal = */ true, slot_exists_ok, /* two_phase = */ false); #elif PG_VERSION_NUM >= 110000 diff --git a/src/utils/pgut.c b/src/utils/pgut.c index df09dbdc..003f0a55 100644 --- a/src/utils/pgut.c +++ b/src/utils/pgut.c @@ -1062,7 +1062,23 @@ handle_interrupt(SIGNAL_ARGS) static void init_cancel_handler(void) { +#if PG_VERSION_NUM < 180000 oldhandler = pqsignal(SIGINT, handle_interrupt); +#else + { + struct sigaction act, oldact; + + act.sa_handler = handle_interrupt; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + + /* Get the previous handler and set the new one */ + if (sigaction(SIGINT, &act, &oldact) < 0) + elog(ERROR, "sigaction(SIGINT) failed: %m"); + + oldhandler = oldact.sa_handler; + } +#endif pqsignal(SIGQUIT, handle_interrupt); pqsignal(SIGTERM, handle_interrupt); pqsignal(SIGPIPE, handle_interrupt);