From bf8b44cb474bc2060dca28346c033a719edd5f03 Mon Sep 17 00:00:00 2001 From: Francisco Miguel Biete Banon Date: Fri, 27 Sep 2024 10:26:14 +0100 Subject: [PATCH] Symbols renamed in PostgreSQL v17 --- pljava-so/src/main/c/InstallHelper.c | 16 ++++++++++++++-- pljava-so/src/main/c/PgSavepoint.c | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pljava-so/src/main/c/InstallHelper.c b/pljava-so/src/main/c/InstallHelper.c index 2cb5a9cb3..707d81323 100644 --- a/pljava-so/src/main/c/InstallHelper.c +++ b/pljava-so/src/main/c/InstallHelper.c @@ -90,7 +90,11 @@ bool pljavaViableXact() char *pljavaDbName() { +#if PG_VERSION_NUM >= 170000 + if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() ) +#else if ( IsAutoVacuumWorkerProcess() || IsBackgroundWorker ) +#endif { char *shortlived; static char *longlived; @@ -110,7 +114,11 @@ char *pljavaDbName() static char *origUserName() { +#if PG_VERSION_NUM >= 170000 + if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() ) +#else if ( IsAutoVacuumWorkerProcess() || IsBackgroundWorker ) +#endif { char *shortlived; static char *longlived; @@ -354,8 +362,12 @@ char *pljavaFnOidToLibPath(Oid fnOid, char **langName, bool *trusted) bool InstallHelper_shouldDeferInit() { - if ( IsBackgroundWorker || IsAutoVacuumWorkerProcess() ) - return true; +#if PG_VERSION_NUM >= 170000 + if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() ) +#else + if ( IsAutoVacuumWorkerProcess() || IsBackgroundWorker ) +#endif + return true; if ( ! IsBinaryUpgrade ) return false; diff --git a/pljava-so/src/main/c/PgSavepoint.c b/pljava-so/src/main/c/PgSavepoint.c index b387ac6ac..6799eb3ed 100644 --- a/pljava-so/src/main/c/PgSavepoint.c +++ b/pljava-so/src/main/c/PgSavepoint.c @@ -187,7 +187,6 @@ Java_org_postgresql_pljava_internal_PgSavepoint__1rollback(JNIEnv* env, jclass c PG_TRY(); { unwind(RollbackAndReleaseCurrentSubTransaction, xid, nestLevel); - SPI_restore_connection(); } PG_CATCH(); {