From 603197d5ab2c1b8c8f90075dff3114d687ad1afd Mon Sep 17 00:00:00 2001 From: Chapman Flack Date: Wed, 2 Oct 2024 20:53:23 -0400 Subject: [PATCH] Use SPI_restore_connection only in PG < 10 SPI_restore_connection was defined as a noop since PostgreSQL 10, and the compatibility macro has been removed in postgres/postgres@75680c3. Because PL/Java 1.6 purports to still run on PostgreSQL 9.5, continue to use the function in PG < 10. Credit to Francisco Miguel Biete Banon in PR #501. --- pljava-so/src/main/c/PgSavepoint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pljava-so/src/main/c/PgSavepoint.c b/pljava-so/src/main/c/PgSavepoint.c index b387ac6ac..45fcca81e 100644 --- a/pljava-so/src/main/c/PgSavepoint.c +++ b/pljava-so/src/main/c/PgSavepoint.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2019 Tada AB and other contributors, as listed below. + * Copyright (c) 2004-2024 Tada AB and other contributors, as listed below. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the The BSD 3-Clause License @@ -187,7 +187,9 @@ Java_org_postgresql_pljava_internal_PgSavepoint__1rollback(JNIEnv* env, jclass c PG_TRY(); { unwind(RollbackAndReleaseCurrentSubTransaction, xid, nestLevel); +#if PG_VERSION_NUM < 100000 SPI_restore_connection(); +#endif } PG_CATCH(); {