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

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

Trivial predicates

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

predicates can be trivial, in case of which the expression can be removed and replaced by a TRUE or FALSE condition.

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

-- With Settings.transformPatternsTrivialPredicates active, this:
SELECT
  a IS NOT DISTINCT FROM a,
  a IS DISTINCT FROM a,
  a >= a,
  a <= a,
  a > a,
  a < a,
  const IS NOT NULL,
  const IS NULL,
  TRUE AND FALSE,
  TRUE OR FALSE,
  NOT TRUE,
  NOT FALSE
  -- and many more
FROM tab;

-- ... is transformed into the equivalent expression:
SELECT
  TRUE,   -- a IS NOT DISTINCT FROM a
  FALSE,  -- a IS DISTINCT FROM a
  a = a,  -- a >= a
  a = a,  -- a <= a
  a != a, -- a > a
  a != a, -- a < a
  TRUE,   -- const IS NOT NULL
  FALSE,  -- const IS NULL
  FALSE,  -- TRUE AND FALSE
  TRUE,   -- TRUE OR FALSE
  FALSE,  -- NOT TRUE
  TRUE    -- NOT FALSE
  -- and many more
FROM tab;

References to this page

Feedback

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

The jOOQ Logo