pentaho/pentaho-kettle · error · KettleDatabaseException

Truncate table not supported by

Error message

Truncate table not supported by 

What it means

Thrown by Database.getDDLTruncateTable() (Database.java:4984) when the connected database type's dialect does not define a TRUNCATE TABLE statement (getTruncateTableStatement returns null) and no transaction/connection group forces a DELETE fallback. Indicates the dialect plugin simply has no TRUNCATE support.

Solutions

  1. Ensure a connection group is active so the method falls back to 'DELETE FROM table' instead of TRUNCATE
  2. Override getTruncateTableStatement() in a custom DatabaseInterface to return a valid statement (e.g. 'TRUNCATE TABLE x' or 'DELETE FROM x')
  3. Use DatabaseMeta.getQuotedSchemaTableCombination plus 'DELETE FROM' manually when you know TRUNCATE is unsupported
  4. Switch to a standard supported database dialect or update the plugin
  5. Check databaseMeta.getPluginName() in the message to identify which dialect needs the fix

Example fix

// before
String ddl = database.getDDLTruncateTable( schema, table );
// after
String ddl = databaseMeta.supportsTruncateTable()
  ? database.getDDLTruncateTable( schema, table )
  : "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, table );
Defensive patterns

Strategy: fallback

Validate before calling

String stmt = databaseMeta.getTruncateTableStatement( schema, tablename );
if ( stmt == null ) {
  stmt = "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, tablename );
}

Try / catch

try {
  ddl = database.getDDLTruncateTable( schema, table );
} catch ( KettleDatabaseException e ) {
  ddl = "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, table );
}

Prevention

When it happens

Trigger: Calling Database.getDDLTruncateTable(schema, tablename) when connectionGroup is empty and the active databaseMeta plugin's getTruncateTableStatement() returns null (dialects without TRUNCATE support).

Common situations: Using a community/custom database plugin that never implemented getTruncateTableStatement; running Table Output truncation against dialects lacking TRUNCATE; building dynamic SQL generation for multiple DB types where one target lacks TRUNCATE.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:4984

    // First, check for reserved SQL in the input row r...
    databaseMeta.quoteReservedWords( fields );
    String quotedTk = databaseMeta.quoteField( null );

    return getCreateTableStatement( tableName, fields, quotedTk, false, null, true );
  }

  /**
   * Return SQL TRUNCATE statement for a Table
   *
   * @param schema    The schema
   * @param tablename The table to create
   * @throws KettleDatabaseException
   */
  public String getDDLTruncateTable( String schema, String tablename ) throws KettleDatabaseException {
    if ( Utils.isEmpty( connectionGroup ) ) {
      String truncateStatement = databaseMeta.getTruncateTableStatement( schema, tablename );
      if ( truncateStatement == null ) {
        throw new KettleDatabaseException( "Truncate table not supported by "
          + databaseMeta.getDatabaseInterface().getPluginName() );
      }
      return truncateStatement;
    } else {
      return ( "DELETE FROM " + databaseMeta.getQuotedSchemaTableCombination( schema, tablename ) );
    }
  }

  /**
   * Return SQL statement (INSERT INTO TableName ...
   *
   * @param schemaName tableName The schema
   * @param tableName
   * @param fields
   * @param dateFormat date format of field
   * @throws KettleDatabaseException
   */

View on GitHub (pinned to f3058517a1)