{"record":{"id":"026193bb31ff842d","repo":"pentaho/pentaho-kettle","slug":"error-while-creating-table","errorCode":null,"errorMessage":"Error while creating table ","messagePattern":"Error while creating table ","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":441,"sourceCode":"      logDetailed( \"getTransMeta: \" + getTransMeta() );\n    }\n    if ( log.isDetailed() ) {\n      logDetailed( \"getStepname: \" + getStepname() );\n    }\n    SQLStatement statement = meta.getTableDdl( getTransMeta(), getStepname(), true, data, true );\n    if ( log.isDetailed() ) {\n      logDetailed( \"Statement: \" + statement );\n    }\n    if ( log.isDetailed() && statement != null ) {\n      logDetailed( \"Statement has SQL: \" + statement.hasSQL() );\n    }\n\n    if ( statement != null && statement.hasSQL() ) {\n      String cmd = statement.getSQL();\n      try {\n        executeSql( cmd );\n      } catch ( Exception e ) {\n        throw new KettleException( \"Error while creating table \" + data.schemaTable, e );\n      }\n    }\n\n    if ( log.isDetailed() ) {\n      logDetailed( \"Successfull\" );\n    }\n  }\n\n  protected void writeBufferToMonetDB() throws KettleException {\n    if ( data.bufferIndex == 0 ) {\n      return;\n    }\n\n    try {\n      StringBuilder cmdBuff = new StringBuilder();\n\n      // first write the COPY INTO command...\n      //","sourceCodeStart":423,"sourceCodeEnd":459,"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#L423-L459","documentation":"Thrown by autoAdjustSchema() when the generated CREATE TABLE / ALTER TABLE statement (from statement.getSQL()) fails while executing against MonetDB. The step builds a schema-adjustment statement from the row fields and executes it; any server-side or connection error is wrapped in this KettleException with the target table name appended.","triggerScenarios":"autoAdjustSchema() has a DatabaseStatement with pending SQL (statement.hasSQL()); executeSql(cmd) throws because the CREATE/ALTER statement is invalid, the schema doesn't exist, the connection fails, or the user lacks DDL privileges.","commonSituations":"Target schema not created on the MonetDB server; incompatible column type mapping from Kettle fields to MonetDB types; reserved-word column names; user lacking CREATE/ALTER privileges; transient connection problems during schema sync.","solutions":["Read the wrapped cause to get the exact SQL error (syntax, type, or privilege)","Verify the target schema exists and the user has CREATE/ALTER rights","Check that field names/types in the transformation map to valid MonetDB columns (quote or rename reserved words)","Test the generated SQL manually in mclient"],"exampleFix":"// before\nthrow new KettleException( \"Error while creating table \" + data.schemaTable, e );\n// after\nthrow new KettleException( \"Error while creating table \" + data.schemaTable + \" with SQL: \" + cmd, e ); // include failing SQL for diagnosis","handlingStrategy":"try-catch","validationCode":"// validate connection + schema before autoAdjustSchema\nif ( meta.getDatabaseMeta() == null ) throw new KettleException( \"No connection defined\" );\nexecuteSqlOnlyIfSchemaExists( environmentSubstitute( meta.getSchemaName() ) );","typeGuard":"if ( statement == null || !statement.hasSQL() ) return; // nothing to execute","tryCatchPattern":"try { loader.autoAdjustSchema( meta ); } catch ( KettleException e ) { log.error( \"schema adjust failed\", e.getCause() ); retry or abort with the failing SQL surfaced to the user }","preventionTips":["Create the target schema before running the bulk loader","Map Kettle field types to valid MonetDB types in the step dialog","Avoid reserved words for column names or quote them","Dry-run the generated DDL in mclient first"],"tags":["database","ddl","monetdb","sql"],"backgroundTag":"sql-query-failed","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"}