Available in versions: Dev (3.18)

This is experimental functionality, and as such subject to change. Use at your own risk!

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Unnecessary scalar subquery

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

A scalar subquery that contains only a projection is unnecessary. While it is unlikely for users to implement such projection only scalar subqueries, they may appear as a result of other transformations. This rule excludes scalar subqueries:

Using Settings.transformPatternsUnnecessaryScalarSubquery, the following transformations can be achieved:

-- With Settings.transformPatternsUnnecessaryScalarSubquery active, this:
SELECT (SELECT a) FROM t WHERE (SELECT a) = b;

-- ... is transformed into the equivalent expression:
SELECT a FROM t WHERE a = b;

Feedback

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

The jOOQ Logo