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
- Ensure a connection group is active so the method falls back to 'DELETE FROM table' instead of TRUNCATE
- Override getTruncateTableStatement() in a custom DatabaseInterface to return a valid statement (e.g. 'TRUNCATE TABLE x' or 'DELETE FROM x')
- Use DatabaseMeta.getQuotedSchemaTableCombination plus 'DELETE FROM' manually when you know TRUNCATE is unsupported
- Switch to a standard supported database dialect or update the plugin
- 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
- Check DatabaseMeta.supportsTruncateTable()/getTruncateTableStatement before use
- Prefer DELETE fallback inside a connection group for portability
- Test generated DDL against every target dialect in CI
- Implement getTruncateTableStatement in custom database plugins
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
- AddSequence.Exception.ErrorReadingSequence
- An error occurred executing SQL:
- Couldn't execute SQL:
- Couldn't find any rows because of an error :
- Couldn't get a result because of an error :
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)