{"record":{"id":"f0130ee7cef49ed4","repo":"pentaho/pentaho-kettle","slug":"truncate-table-is-not-supported","errorCode":null,"errorMessage":"Truncate table is not supported!","messagePattern":"Truncate table is not supported!","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java","lineNumber":387,"sourceCode":"      //\n      line.append( data.newline );\n\n      // Now that we have the line, grab the content and store it in the buffer...\n      //\n      data.rowBuffer[data.bufferIndex] = line.toString(); // line.toByteArray();\n      data.bufferIndex++;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error serializing rows of data to the MonetDB API (MAPI).\", e );\n    }\n\n  }\n\n  public void truncate() throws KettleException {\n    String cmd;\n    String table = data.schemaTable;\n    String truncateStatement = meta.getDatabaseMeta().getTruncateTableStatement( null, table );\n    if ( truncateStatement == null ) {\n      throw new KettleException( \"Truncate table is not supported!\" );\n    }\n    cmd = truncateStatement + \";\";\n\n    try {\n      executeSql( cmd );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error while truncating table \" + table, e );\n    }\n\n    // try to update the metadata registry\n    util.updateMetadata( meta, -1 );\n    if ( log.isDetailed() ) {\n      logDetailed( \"Successfull: \" + cmd );\n    }\n\n  }\n\n  public void drop() throws KettleException {","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java#L369-L405","documentation":"MonetDBBulkLoader.truncate builds its statement from the database meta's getTruncateTableStatement(). When that returns null — the configured dialect does not support TRUNCATE for this target — a KettleException is thrown. It protects the step from executing an invalid or fallback statement.","triggerScenarios":"execute() sees the truncate option enabled and calls truncate(); the configured DatabaseMeta dialect returns null from getTruncateTableStatement (unsupported dialect).","commonSituations":"Pointing the bulk loader connection at a non-MonetDB or unsupported database dialect; custom/modified connection type; older database plugin lacking truncate support for the dialect.","solutions":["Verify the connection's database type is MonetDB (or a dialect implementing getTruncateTableStatement)","If the dialect doesn't support truncate, disable truncate and run a separate Execute SQL DELETE step instead","Upgrade PDI/database plugin versions so the dialect supports truncate statements","Confirm the schemaTable name resolved correctly (bad table resolution can short-circuit statement generation)"],"exampleFix":"// before: truncate enabled on an unsupported-dialect connection\nTruncate table = true   (connection: Generic DB)\n// after\nTruncate table = false; use an 'Execute SQL' step: DELETE FROM schema.table","handlingStrategy":"fallback","validationCode":"// Detect truncate support before enabling the option\nString stmt = meta.getDatabaseMeta().getTruncateTableStatement(null, \"schema.table\");\nif (stmt == null) {\n  System.out.println(\"Dialect \" + meta.getDatabaseMeta().getPluginId()\n      + \" does not support TRUNCATE; disable truncate or use DELETE\");\n}","typeGuard":"null","tryCatchPattern":"try {\n  step.run();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"Truncate table is not supported\")) {\n    logError(\"Switch to a DELETE-based clear step or fix the connection dialect\");\n  }\n}","preventionTips":["Use a genuine MonetDB connection type for the bulk loader step","Don't reuse generic/ODBC connections for MonetDB bulk loading","Re-verify the truncate option after any connection-type change","Test the flow on staging after database connection migrations"],"tags":["monetdb","truncate","unsupported","bulk-loader"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}