Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CI/common
Original file line number Diff line number Diff line change
Expand Up @@ -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;
29 changes: 19 additions & 10 deletions CI/integration
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pljava-so/src/main/c/Function.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -789,6 +789,7 @@ static Function Function_create(
funcOid);
}

Invocation_assertDisconnect(); /* func may make its own connection */
return self;
}

Expand Down
Loading