Skip to content

Commit

Permalink
Use SPI_restore_connection only in PG < 10
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jcflack committed Oct 3, 2024
1 parent 278e8c1 commit 603197d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pljava-so/src/main/c/PgSavepoint.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
{
Expand Down

0 comments on commit 603197d

Please sign in to comment.