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

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.

Normalise IN list with single element to comparison

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

When comparing an IN predicate with a single value, then it may be beneficial for other pattern replacement if that expression is normalised to a comparison predicate.

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

-- With Settings.transformPatternsNormaliseInListSingleElementToComparison active, this:
SELECT
  x IN (a),
  x NOT IN (a)
FROM tab;

-- ... is transformed into the equivalent expression:
SELECT
  x = a, -- x IN (a),
  x != a -- x NOT IN (a)
FROM tab;

Feedback

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

The jOOQ Logo