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(); {