{"record":{"id":"504a76e4555c3b4a","repo":"pentaho/pentaho-kettle","slug":"unable-to-retrieve-auto-increment-of-combi-insert-key-meta","errorCode":null,"errorMessage":"Unable to retrieve auto-increment of combi insert key :  + meta.getTechnicalKeyField() + , no fields in resultset","messagePattern":"Unable to retrieve auto-increment of combi insert key :  \\+ meta\\.getTechnicalKeyField\\(\\) \\+ , no fields in resultset","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java","lineNumber":630,"sourceCode":"        logRowlevel( \"rins=\" + data.insertRowMeta.getString( insertRow ) );\n      }\n\n      debug = \"Set values on insert\";\n      // INSERT NEW VALUE!\n      data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert );\n\n      debug = \"Insert row\";\n      data.db.insertRow( data.prepStatementInsert );\n\n      debug = \"Retrieve key\";\n      if ( isAutoIncrement() && databaseMeta.supportsAutoGeneratedKeys() ) {\n        ResultSet keys = null;\n        try {\n          keys = data.prepStatementInsert.getGeneratedKeys(); // 1 key\n          if ( keys.next() ) {\n            val_key = new Long( keys.getLong( 1 ) );\n          } else {\n            throw new KettleDatabaseException( \"Unable to retrieve auto-increment of combi insert key : \"\n              + meta.getTechnicalKeyField() + \", no fields in resultset\" );\n          }\n        } catch ( SQLException ex ) {\n          throw new KettleDatabaseException( \"Unable to retrieve auto-increment of combi insert key : \"\n            + meta.getTechnicalKeyField(), ex );\n        } finally {\n          try {\n            if ( keys != null ) {\n              keys.close();\n            }\n          } catch ( SQLException ex ) {\n            throw new KettleDatabaseException( \"Unable to retrieve auto-increment of combi insert key : \"\n              + meta.getTechnicalKeyField(), ex );\n          }\n        }\n      }\n    } catch ( Exception e ) {\n      logError( Const.getStackTracker( e ) );","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java#L612-L648","documentation":"KettleDatabaseException thrown when getGeneratedKeys() after the combi insert returns a ResultSet whose first next() is false, i.e. the driver gave back no auto-generated key at all. The step needs the auto-increment technical key it just inserted; without it the dimension lookup cannot return the row's key.","triggerScenarios":"combiInsert executed the insert via prepStatementInsert and called getGeneratedKeys(), but keys.next() returned false — the JDBC driver returned an empty generated-keys result set for this statement/table.","commonSituations":"Databases or drivers that don't return generated keys for the configured auto-increment setup (e.g. certain PostgreSQL/Oracle configurations); technical key field not actually an auto-increment/identity column; using autoinc mode with a driver lacking Statement.RETURN_GENERATED_KEYS support.","solutions":["Verify the technical key column in the dimension table is a real auto-increment/identity/serial column.","Switch the step's 'Use auto increment' off and use a database sequence or table max+1 tech key creation method instead.","Update the JDBC driver to a version that supports getGeneratedKeys for your database.","If the DB supports it, configure the connection/driver so generated keys are returned (e.g. appropriate returnGeneratedKeys setting)."],"exampleFix":"// before: technical key relies on auto-increment on a driver that returns no keys\n// after: in CombinationLookup step settings set Technical key field creation method\n//        from 'auto increment' to 'use sequence' (e.g. seq_dim_customer) or 'table maximum'.","handlingStrategy":"validation","validationCode":"// before the run, confirm the tech key column is auto-increment capable\n// String ddl = db.getDDBinary(...) /* or query information_schema */;\n// assert column is serial/identity/auto_increment for the configured technicalKeyField;","typeGuard":null,"tryCatchPattern":"try { /* run */ } catch (KettleDatabaseException e) {\n  if (e.getMessage().contains(\"no fields in resultset\")) {\n    log.error(\"Driver returned no generated keys; switch tech key creation method\");\n  }\n}","preventionTips":["Prefer sequence or table-maximum key creation over auto-increment unless the driver is known to support getGeneratedKeys.","Test generated-key retrieval with a tiny standalone JDBC snippet for your driver.","Keep JDBC drivers up to date.","Document per-database key creation settings in your team's transformation standards."],"tags":["database","jdbc","auto-increment","generated-keys"],"backgroundTag":"empty-result-set","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"}