Available in versions: Dev (3.20) | Latest (3.19) | 3.18

Object qualification for columns

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

By default, jOOQ fully qualifies all columns with their table names (and the tables might themselves be qualified). This is a reasonable default, as any JOIN operation may produce ambiguous column names, such as the ubiquitous names ID or CREATED_AT.

-- Columns always qualified with table name.
SELECT table.column
FROM table
DSL.using(configuration)
   .select(TABLE.COLUMN)
   .from(TABLE);

In rare cases, it may be desirable to drop this qualification, keeping it only either:

  • ALWAYS: This is the default. Columns are always qualified with their table.
  • WHEN_MULTIPLE_TABLES: When the FROM clause has multiple tables.
  • WHEN_AMBIGUOUS_COLUMNS: When the FROM clause produces ambiguous columns.
  • NEVER: Qualification is always dropped. This may produce semantically wrong SQL and is intended only to be used on a query by query basis, if any of the above does not implement requirements as desired.

Example configuration

new Settings()
  .withRenderTable(RenderTable.WHEN_MULTIPLE_TABLES) // Defaults to ALWAYS

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo