[#2920] Emulate CROSS APPLY as LATERAL JOIN for PostgreSQL

This commit is contained in:
lukaseder 2015-09-11 15:57:16 +02:00
parent 4ba8dcab90
commit dc449160e9
5 changed files with 257 additions and 256 deletions

View File

@ -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<R extends Record> extends SelectWhereStep<R> {
// XXX: APPLY clauses on tables
// -------------------------------------------------------------------------
/* [pro] xx
/**
* <code>CROSS APPLY</code> a table to this table.
*
* @see Table#crossApply(TableLike)
*/
@Support({ POSTGRES_9_3 })
SelectJoinStep<R> 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
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> 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
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> 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
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> 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
/**
* <code>OUTER APPLY</code> a table to this table.
*
* @see Table#outerApply(TableLike)
*/
@Support({ POSTGRES_9_3 })
SelectJoinStep<R> 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
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> 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
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> 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] */
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<R> outerApply(String sql, QueryPart... parts);
/**
* <code>STRAIGHT_JOIN</code> a table to this table.

View File

@ -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<R extends Record> extends TableLike<R> {
// XXX: APPLY clauses on tables
// -------------------------------------------------------------------------
/* [pro] xx
/**
* <code>CROSS APPLY</code> a table to this table.
*/
@Support({ POSTGRES_9_3 })
Table<Record> crossApply(TableLike<?> table);
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> 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
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> 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
/**
* <code>CROSS APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> 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
/**
* <code>OUTER APPLY</code> a table to this table.
*/
@Support({ POSTGRES_9_3 })
Table<Record> outerApply(TableLike<?> table);
xxx
x xxxxxxxxxxx xxxxxxxxxxxx x xxxxx xx xxxx xxxxxx
xx
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxx xx
xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> 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
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> 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] */
/**
* <code>OUTER APPLY</code> a table to this table.
* <p>
* <b>NOTE</b>: 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<Record> outerApply(String sql, QueryPart... parts);
/**
* <code>STRAIGHT_JOIN</code> a table to this table.

View File

@ -828,49 +828,45 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
return naturalRightOuterJoin(table(sql, parts));
}
/* [pro] xx
@Override
public final Table<Record> crossApply(TableLike<?> table) {
return join(table, CROSS_APPLY);
}
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx
x
@Override
public final Table<Record> crossApply(String sql) {
return crossApply(table(sql));
}
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
@Override
public final Table<Record> 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<Record> 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<Record> outerApply(TableLike<?> table) {
return join(table, OUTER_APPLY);
}
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx xxxxxx x
xxxxxx xxxxxxxxxxx xxxxxxxxxxxxx
x
@Override
public final Table<Record> outerApply(String sql) {
return outerApply(table(sql));
}
xxxxxxxxx
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxx x
xxxxxx xxxxxxxxxxxxxxxxxxxxxxx
x
@Override
public final Table<Record> 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<Record> outerApply(String sql, QueryPart... parts) {
return outerApply(table(sql, parts));
}
@Override
public final TableOptionalOnStep straightJoin(TableLike<?> table) {

View File

@ -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<Record> 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<Record> 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) {

View File

@ -2141,19 +2141,15 @@ class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,
return join(table, JoinType.NATURAL_RIGHT_OUTER_JOIN);
}
/* [pro] xx
@Override
public final SelectImpl crossApply(TableLike<?> 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) {