[jOOQ/jOOQ#13664] Added Javadoc hints to Table::as

As explained in the issue comments, a Table cannot be aliased as a Field independently of its table aliasing in the jOOQ API. This means that when calling Table.as() to alias a table in the projection (SELECT), the expectation is that the alias is also declared in FROM.

In order to alias a table only in the projection, the Table has to be wrapped using DSL.field(SelectField), first.
This commit is contained in:
Lukas Eder 2022-06-14 10:56:26 +02:00
parent 20fd0937f4
commit ddb55b5372

View File

@ -382,6 +382,12 @@ extends
* Note that the case-sensitivity of the returned table depends on
* {@link Settings#getRenderQuotedNames()}. By default, table aliases are
* quoted, and thus case-sensitive in many SQL dialects!
* <p>
* This method works both to alias the table as well as alias the table in
* its {@link SelectField} form via the {@link SelectField#as(String)}
* override. In order to alias only the projected table expression, use
* {@link DSL#field(SelectField)} to wrap this table into a {@link Field}
* first.
*
* @param alias The alias name
* @return The table alias
@ -561,6 +567,11 @@ extends
* <p>
* If the argument {@link Name#getName()} is qualified, then the
* {@link Name#last()} part will be used.
* <p>
* This method works both to alias the table as well as alias the table in
* its {@link SelectField} form via the {@link SelectField#as(String)}
* override. In order to alias only the projected table expression, use
* {@link DSL#field(SelectField)} to wrap this table into a {@link Field}
*
* @param alias The alias name
* @return The table alias