From b8d633bceb5657f0a87e41b7f227a8c9c6e4cf49 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Wed, 16 May 2018 12:40:12 +0200 Subject: [PATCH] [#7493] Emulate { OUTER | CROSS } APPLY on DB2 --- jOOQ/src/main/java/org/jooq/impl/JoinTable.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java index 8c45e3cf73..11a64b1d35 100755 --- a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java @@ -142,6 +142,7 @@ implements private static final EnumSet EMULATE_NATURAL_JOIN = EnumSet.of(CUBRID); private static final EnumSet EMULATE_NATURAL_OUTER_JOIN = EnumSet.of(CUBRID, H2); private static final EnumSet EMULATE_JOIN_USING = EnumSet.of(CUBRID, H2); + private static final EnumSet EMULATE_APPLY = EnumSet.of(POSTGRES); final Table lhs; final Table rhs; @@ -199,9 +200,9 @@ implements Keyword keyword = translatedType.toKeyword(); - if (translatedType == CROSS_APPLY && ctx.family() == POSTGRES) + if (translatedType == CROSS_APPLY && EMULATE_APPLY.contains(ctx.family())) keyword = K_CROSS_JOIN_LATERAL; - else if (translatedType == OUTER_APPLY && ctx.family() == POSTGRES) + else if (translatedType == OUTER_APPLY && EMULATE_APPLY.contains(ctx.family())) keyword = K_LEFT_OUTER_JOIN_LATERAL; @@ -278,16 +279,14 @@ implements NATURAL_LEFT_OUTER_JOIN, NATURAL_RIGHT_OUTER_JOIN, CROSS_APPLY, - OUTER_APPLY).contains(translatedType)) { + OUTER_APPLY).contains(translatedType)) toSQLJoinCondition(ctx); - } - else if (OUTER_APPLY == translatedType && ctx.family() == POSTGRES) { + else if (OUTER_APPLY == translatedType && EMULATE_APPLY.contains(ctx.family())) ctx.formatSeparator() .start(TABLE_JOIN_ON) .visit(K_ON) - .sql(" true") + .sql(" 1 = 1") .end(TABLE_JOIN_ON); - } ctx.end(translatedClause) .formatIndentEnd();