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

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

Trivial condition

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

The SPI methods handling these events are trivialCondition(). This diagnostic depends on the transform patterns feature.

This problem appears with JDBC, jOOQ or with any ORM. A predicate of arbitrary complexity can sometimes be reduced to a simple TRUE or FALSE condition.

Why is it bad?

A trivial condition is bad for your application for multiple reasons:

  • It could just be a typo (e.g. a JOIN predicate of the form A.ID = A.ID instead of A.ID = B.ID), in case of which it's simply wrong.
  • The redundant predicate might be a subtle cause for duplicate statements.

An example is given here:

// A custom DiagnosticsListener SPI implementation
class TrivialCondition extends DefaultDiagnosticsListener {
    public void trivialCondition(DiagnosticsContext ctx) {
        System.out.println("Trivial condition: " + ctx.part());

// Configuration is configured with the target DataSource, SQLDialect, etc. for instance Oracle.
try (Connection c = DSL.using(configuration.derive(new TrivialCondition()))
     Statement s = c.createStatement()) {
    try (ResultSet rs = s.executeQuery("SELECT * FROM author WHERE id = id")) {
        // ..


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

The jOOQ Logo