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

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.

DISTINCT FROM NULL

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

The DISTINCT predicate is a verbose way of NULL safe comparisons. If one of the operands is NULL, then it can be simplified to the NULL predicate.

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

-- With Settings.transformPatternsDistinctFromNull active, this:
SELECT
  a IS NOT DISTINCT FROM NULL,
  a IS DISTINCT FROM NULL
FROM tab;

-- ... is transformed into the equivalent expression:
SELECT
  a IS NULL,
  a IS NOT NULL
FROM tab;

Feedback

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

The jOOQ Logo