diff --git a/CI/common b/CI/common index 08df17edc..f26509b0e 100644 --- a/CI/common +++ b/CI/common @@ -279,4 +279,32 @@ boolean loadExamplesAndTest(Connection c) throws Exception ); } +/* + * Unloads the PL/Java example and Saxon jars, returning true if that produced + * the expected sequence of results (not necessarily meaning success, unless + * results.get("ng") is also zero afterward. + */ +boolean unloadExamples(Connection c) throws Exception +{ + return stateMachine( + "remove example and saxon jars", + null, + + Stream.concat( + Node.removeJar(c, "examples", true), + Node.removeJar(c, "saxon", false) + ) + .flatMap(Node::semiFlattenDiagnostics) + .peek(Node::peek), + + (o,p,q) -> isDiagnostic(o, Set.of("error")) ? 1 : -2, + (o,p,q) -> isVoidResultSet(o, 1, 1) ? 3 : false, + + (o,p,q) -> isDiagnostic(o, Set.of("error")) ? 3 : -4, + (o,p,q) -> isVoidResultSet(o, 1, 1) ? 5 : false, + + (o,p,q) -> null == o + ); +} + int pgMajorVersion; diff --git a/CI/integration b/CI/integration index 7690cd8e2..920eba303 100644 --- a/CI/integration +++ b/CI/integration @@ -205,18 +205,27 @@ try ( /* * Also confirm that the generated undeploy actions work. */ - succeeding &= stateMachine( - "remove jar void result", - null, + unloadExamples(c); - q(c, "SELECT sqlj.remove_jar('examples', true)") - .flatMap(Node::semiFlattenDiagnostics) - .peek(Node::peek), + /* + * Repeat the regression tests with check_function_bodies off (issue 544). + */ + try ( Connection c2 = n1.connect() ) + { + succeeding &= stateMachine( + "check_function_bodies off", + null, - (o,p,q) -> isDiagnostic(o, Set.of("error")) ? 1 : -2, - (o,p,q) -> isVoidResultSet(o, 1, 1) ? 3 : false, - (o,p,q) -> null == o - ); + q(c2, "SET check_function_bodies TO off") + .flatMap(Node::semiFlattenDiagnostics) + .peek(Node::peek), + + (o,p,q) -> isDiagnostic(o, Set.of("error")) ? 1 : -2, + NOTHING_OR_PGJDBC_ZERO_COUNT, + (o,p,q) -> null == o + ); + succeeding &= loadExamplesAndTest(c2) && unloadExamples(c2); + } /* * Get another new connection and make sure the extension can be diff --git a/pljava-so/src/main/c/Function.c b/pljava-so/src/main/c/Function.c index 891591a6e..1913ece84 100644 --- a/pljava-so/src/main/c/Function.c +++ b/pljava-so/src/main/c/Function.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2025 Tada AB and other contributors, as listed below. + * Copyright (c) 2004-2026 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 @@ -789,6 +789,7 @@ static Function Function_create( funcOid); } + Invocation_assertDisconnect(); /* func may make its own connection */ return self; }