pentaho/pentaho-kettle · error · KettleException

Error while creating table

Error message

Error while creating table 

What it means

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.

Solutions

  1. Read the wrapped cause to get the exact SQL error (syntax, type, or privilege)
  2. Verify the target schema exists and the user has CREATE/ALTER rights
  3. Check that field names/types in the transformation map to valid MonetDB columns (quote or rename reserved words)
  4. Test the generated SQL manually in mclient

Example fix

// before
throw new KettleException( "Error while creating table " + data.schemaTable, e );
// after
throw new KettleException( "Error while creating table " + data.schemaTable + " with SQL: " + cmd, e ); // include failing SQL for diagnosis
Defensive patterns

Strategy: try-catch

Validate before calling

// validate connection + schema before autoAdjustSchema
if ( meta.getDatabaseMeta() == null ) throw new KettleException( "No connection defined" );
executeSqlOnlyIfSchemaExists( environmentSubstitute( meta.getSchemaName() ) );

Type guard

if ( statement == null || !statement.hasSQL() ) return; // nothing to execute

Try / catch

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 }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/026193bb31ff842d. Report an issue: GitHub.

Appendix: source

Thrown at plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java:441

      logDetailed( "getTransMeta: " + getTransMeta() );
    }
    if ( log.isDetailed() ) {
      logDetailed( "getStepname: " + getStepname() );
    }
    SQLStatement statement = meta.getTableDdl( getTransMeta(), getStepname(), true, data, true );
    if ( log.isDetailed() ) {
      logDetailed( "Statement: " + statement );
    }
    if ( log.isDetailed() && statement != null ) {
      logDetailed( "Statement has SQL: " + statement.hasSQL() );
    }

    if ( statement != null && statement.hasSQL() ) {
      String cmd = statement.getSQL();
      try {
        executeSql( cmd );
      } catch ( Exception e ) {
        throw new KettleException( "Error while creating table " + data.schemaTable, e );
      }
    }

    if ( log.isDetailed() ) {
      logDetailed( "Successfull" );
    }
  }

  protected void writeBufferToMonetDB() throws KettleException {
    if ( data.bufferIndex == 0 ) {
      return;
    }

    try {
      StringBuilder cmdBuff = new StringBuilder();

      // first write the COPY INTO command...
      //

View on GitHub (pinned to f3058517a1)