diff --git a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java index 88201670e6..301b7c9df6 100644 --- a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java @@ -56,6 +56,7 @@ import static org.jooq.SQLDialect.MYSQL; // ... // ... import static org.jooq.SQLDialect.POSTGRES; +import static org.jooq.SQLDialect.POSTGRES_9_3; import static org.jooq.SQLDialect.SQLITE; // ... // ... @@ -712,121 +713,117 @@ public interface SelectJoinStep extends SelectWhereStep { // XXX: APPLY clauses on tables // ------------------------------------------------------------------------- - /* [pro] xx + /** + * CROSS APPLY a table to this table. + * + * @see Table#crossApply(TableLike) + */ + @Support({ POSTGRES_9_3 }) + SelectJoinStep crossApply(TableLike table); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x - x xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String) + * @see Table#crossApply(String) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep crossApply(String sql); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, Object...) + * @see Table#crossApply(String, Object...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep crossApply(String sql, Object... bindings); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, QueryPart...) + * @see Table#crossApply(String, QueryPart...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep crossApply(String sql, QueryPart... parts); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx + /** + * OUTER APPLY a table to this table. + * + * @see Table#outerApply(TableLike) + */ + @Support({ POSTGRES_9_3 }) + SelectJoinStep outerApply(TableLike table); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x - x xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String) + * @see Table#outerApply(String) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep outerApply(String sql); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, Object...) + * @see Table#outerApply(String, Object...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep outerApply(String sql, Object... bindings); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx - - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx - - xx [/pro] */ + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, QueryPart...) + * @see Table#outerApply(String, QueryPart...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + SelectJoinStep outerApply(String sql, QueryPart... parts); /** * STRAIGHT_JOIN a table to this table. diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index 89df84fd69..ed94023b90 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -58,6 +58,7 @@ import static org.jooq.SQLDialect.MYSQL; // ... // ... import static org.jooq.SQLDialect.POSTGRES; +import static org.jooq.SQLDialect.POSTGRES_9_3; import static org.jooq.SQLDialect.SQLITE; // ... // ... @@ -840,111 +841,107 @@ public interface Table extends TableLike { // XXX: APPLY clauses on tables // ------------------------------------------------------------------------- - /* [pro] xx + /** + * CROSS APPLY a table to this table. + */ + @Support({ POSTGRES_9_3 }) + Table crossApply(TableLike table); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table crossApply(String sql); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, Object...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table crossApply(String sql, Object... bindings); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx + /** + * CROSS APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, QueryPart...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table crossApply(String sql, QueryPart... parts); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx + /** + * OUTER APPLY a table to this table. + */ + @Support({ POSTGRES_9_3 }) + Table outerApply(TableLike table); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table outerApply(String sql); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxx + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, Object...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table outerApply(String sql, Object... bindings); - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxx - - xxx - x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx - x xxx - x xxxxxxxxxxxx xxxx xxxxxxxxx xxxxx xxx xxxx xxxx xxxxxxxx xxx xxxx - x xxxxxxxxx xxxxxx xxxxxxxxxx xxx xxx xxxx xxxxxx xxx xxxxxxxxxxx xx - x xxxxxxxxx xxx xxxxxxxxxx xx xxxx xx xxxxxxxx xxx xxxx xxxxxxxxx xxxxxx - x xxxxxx xxxxxxxx xxxx xxxxxxxxxxxx xxxx xxx xxxxxxxx - x - x xxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxx - x xxxx xxx - xx - xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx - xxxxxxxxx - xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxxx - - xx [/pro] */ + /** + * OUTER APPLY a table to this table. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @see DSL#table(String, QueryPart...) + * @see SQL + */ + @Support({ POSTGRES_9_3 }) + @PlainSQL + Table outerApply(String sql, QueryPart... parts); /** * STRAIGHT_JOIN a table to this table. diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index 50ff686009..8492bffe52 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -828,49 +828,45 @@ abstract class AbstractTable extends AbstractQueryPart impleme return naturalRightOuterJoin(table(sql, parts)); } - /* [pro] xx + @Override + public final Table crossApply(TableLike table) { + return join(table, CROSS_APPLY); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx - x + @Override + public final Table crossApply(String sql) { + return crossApply(table(sql)); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxxxx - x + @Override + public final Table crossApply(String sql, Object... bindings) { + return crossApply(table(sql, bindings)); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx - x + @Override + public final Table crossApply(String sql, QueryPart... parts) { + return crossApply(table(sql, parts)); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx - x + @Override + public final Table outerApply(TableLike table) { + return join(table, OUTER_APPLY); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx - x + @Override + public final Table outerApply(String sql) { + return outerApply(table(sql)); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxxxx - x + @Override + public final Table outerApply(String sql, Object... bindings) { + return outerApply(table(sql, bindings)); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx - x - - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx xxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxx - x - - xx [/pro] */ + @Override + public final Table outerApply(String sql, QueryPart... parts) { + return outerApply(table(sql, parts)); + } @Override public final TableOptionalOnStep straightJoin(TableLike table) { diff --git a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java index fb7fc4ca52..4665bfdfb1 100644 --- a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java @@ -73,6 +73,7 @@ import static org.jooq.SQLDialect.H2; // ... // ... // ... +import static org.jooq.SQLDialect.POSTGRES; // ... // ... import static org.jooq.impl.DSL.condition; @@ -156,9 +157,16 @@ class JoinTable extends AbstractTable implements TableOptionalOnStep, Ta String keyword = translatedType.toSQL(); + if (translatedType == CROSS_APPLY && ctx.family() == POSTGRES) { + keyword = "cross join lateral"; + } + else if (translatedType == OUTER_APPLY && ctx.family() == POSTGRES) { + keyword = "left outer join lateral"; + } + /* [pro] xx xx xx xx xxxxxxx xxx xxxxx xxxxxxx xx xxx xxxxxxxx - xx xxxxxxxxxxxxxxx xx xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxx x + xxxx xx xxxxxxxxxxxxxxx xx xxxx xx xxxxxxxxxxxx xx xxxxxxx x xxxxxxx x xxxxxx xxxxxx x xx [/pro] */ @@ -194,9 +202,16 @@ class JoinTable extends AbstractTable implements TableOptionalOnStep, Ta OUTER_APPLY).contains(translatedType)) { toSQLJoinCondition(ctx); } + else if (OUTER_APPLY == translatedType && ctx.family() == POSTGRES) { + ctx.formatSeparator() + .start(TABLE_JOIN_ON) + .keyword("on") + .sql(" true") + .end(TABLE_JOIN_ON); + } ctx.end(translatedClause) - .formatIndentEnd(); + .formatIndentEnd(); } private void toSQLTable(Context ctx, Table table) { diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java index 073e8d2ae2..4aa435381e 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java @@ -2141,19 +2141,15 @@ class SelectImpl table) { + return join(table, JoinType.CROSS_APPLY); + } - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx - x - - xxxxxxxxx - xxxxxx xxxxx xxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x - xxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx - x - - xx [/pro] */ + @Override + public final SelectImpl outerApply(TableLike table) { + return join(table, JoinType.OUTER_APPLY); + } @Override public final SelectImpl straightJoin(TableLike table) {