pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to determine if indexes exists on table [" +…

Error message

Unable to determine if indexes exists on table [" + tablename + "]

What it means

MSSQLServerDatabaseMeta.checkIndexExists() runs SQL against SQL Server system views to determine whether the indexes used by Kettle exist on the table. Any failure (SQL error, permissions, unsupported SQL Server variant) is wrapped in this KettleDatabaseException. It means Kettle could not verify index existence — not necessarily that the indexes are missing.

Solutions

  1. Read the cause for the underlying SQLException
  2. Grant the connecting user permission to read catalog views (VIEW DEFINITION / SELECT on sys.*)
  3. Verify the database type matches the actual server (MSSQL native vs MS SQL Server (native) vs Sybase)
  4. Run the index-existence check manually with the table name to see the failing statement

Example fix

// before
-- limited login → catalog query fails
GRANT SELECT ON sys.indexes TO kettle_user;
// after
GRANT VIEW DEFINITION TO kettle_user;
GRANT SELECT ON sys.indexes TO kettle_user;
Defensive patterns

Strategy: try-catch

Validate before calling

Database db = new Database( dbMeta );
db.connect();
ResultSet rs = db.openQuery( "SELECT 1 FROM sys.indexes" ); // probe catalog access
if ( rs == null ) log.warn( "no access to sys.indexes — index checks will fail" );

Try / catch

try { exists = meta.checkIndexExists( table, idx, monitor ); } catch ( KettleDatabaseException e ) { log.error( "index check failed for " + table + ": " + e.getCause(), e ); }

Prevention

When it happens

Trigger: Calling checkIndexExists against a table on SQL Server when the metadata/index-lookup query throws — the DB user cannot read sys.indexes/sys.objects, the table name is invalid or quoted incorrectly, or the SQL Server version/Sybase variant lacks the queried catalog views.

Common situations: Running Kettle DDL checks with a limited login lacking VIEW DEFINITION; pointing a 'MSSQL' database type at Azure SQL/Sybase where the catalog query differs; table names with special characters/brackets needing different quoting.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/97a4e7c1061a912b. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/MSSQLServerDatabaseMeta.java:429

          return false;
        }
      } finally {
        if ( res != null ) {
          database.closeQuery( res );
        }
      }

      // See if all the fields are indexed...
      boolean all = true;
      for ( int i = 0; i < exists.length && all; i++ ) {
        if ( !exists[i] ) {
          all = false;
        }
      }

      return all;
    } catch ( Exception e ) {
      throw new KettleDatabaseException( "Unable to determine if indexes exists on table [" + tablename + "]", e );
    }
  }

  @Override
  public String getSQLListOfSchemas() {
    return "select name from sys.schemas";
  }

  @Override
  public boolean supportsSchemas() {
    return true;
  }

  /**
   * Get the SQL to insert a new empty unknown record in a dimension.
   *
   * @param schemaTable
   *          the schema-table name to insert into

View on GitHub (pinned to f3058517a1)