diff --git a/jOOQ-codegen-gradle/build.gradle.kts b/jOOQ-codegen-gradle/build.gradle.kts
index 430425b08d..d6157afc4a 100644
--- a/jOOQ-codegen-gradle/build.gradle.kts
+++ b/jOOQ-codegen-gradle/build.gradle.kts
@@ -7,8 +7,8 @@ plugins {
}
java {
- sourceCompatibility = JavaVersion.VERSION_17
- targetCompatibility = JavaVersion.VERSION_17
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
}
repositories {
diff --git a/jOOQ-xtend/pom.xml b/jOOQ-xtend/pom.xml
index e7ed724acc..d0068fcdde 100644
--- a/jOOQ-xtend/pom.xml
+++ b/jOOQ-xtend/pom.xml
@@ -46,12 +46,12 @@
UTF-8
- 17
+ 21
- 17
- 17
+ 21
+ 21
diff --git a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java
index 7a71b20915..3e53e1bf58 100755
--- a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java
+++ b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java
@@ -658,8 +658,8 @@ abstract class JoinTable> extends AbstractJoinTable {
&& ctx.data(DATA_RENDER_IMPLICIT_JOIN) == null
) {
toSQLJoinCondition(ctx, DSL.and(
- lhs instanceof TableImpl> ti ? ti.pathCondition() : noCondition(),
- rhs instanceof TableImpl> ti ? ti.pathCondition() : noCondition(),
+ lhs instanceof TableImpl> ti ? pathConditionIfInCurrentScope(ctx, ti) : noCondition(),
+ rhs instanceof TableImpl> ti ? pathConditionIfInCurrentScope(ctx, ti) : noCondition(),
condition.getWhere()
));
}
@@ -669,6 +669,14 @@ abstract class JoinTable> extends AbstractJoinTable {
toSQLJoinCondition(ctx, condition);
}
+ private final Condition pathConditionIfInCurrentScope(Context> ctx, TableImpl> ti) {
+
+ // [#15936] Don't add path correlation predicates to JOIN .. ON clauses.
+ // It's wrong for OUTER JOIN or some nested join trees, and they're already
+ // being added in SelectQueryImpl
+ return ctx.inCurrentScope(ti.path) ? ti.pathCondition() : noCondition();
+ }
+
@SuppressWarnings({ "rawtypes", "unchecked" })
final Condition naturalCondition() {
List conditions = new ArrayList<>(using.size());
diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
index 476e741e85..416ef3ef07 100644
--- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java
@@ -2983,6 +2983,19 @@ final class SelectQueryImpl extends AbstractResultQuery imp
Table> t0 = result.get(i);
Table> t1 = prependPathJoins(ctx, where, t0, CROSS_JOIN);
+ // [#15936] If join tree leaves contain paths, generate the path correlation predicate here
+ // [#15967] But only if they're in scope, and not in the current scope
+ traverseJoins(t1, where, null, l -> true, r -> true, null,
+ (w, t) -> {
+ if (TableImpl.path(t) != null && t instanceof TableImpl> ti) {
+ if (ctx.inScope(ti.path) && !ctx.inCurrentScope(ti.path))
+ w.addConditions(ti.pathCondition());
+ }
+
+ return w;
+ }
+ );
+
if (t0 != t1)
result.set(i, t1);
}
diff --git a/pom.xml b/pom.xml
index 3d786e39f4..3e4b60c828 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,9 @@
4.0.1
4.0.4
+
+ 21
+
2.13.11
3.3.1
@@ -587,7 +590,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.11.0
+ 3.13.0
- 17
- 17
+ 21
+ 21
true
lines,vars,source