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

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