[
https://issues.apache.org/jira/browse/DERBY-7037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16792074#comment-16792074
]
Piotr Zygielo commented on DERBY-7037:
--------------------------------------
Immediate reason for NPEx in
[InternalTriggerExecutionContext.java:579|https://github.com/apache/derby/blob/62a5405d98bc5420ae121764d07880bc2573c822/java/engine/org/apache/derby/impl/sql/execute/InternalTriggerExecutionContext.java#L579]
(due to {{dvd == null}}) seems to be the fact, that {{afterRow.nColumns() ==
2}} (as only two columns are used from {{OLD}} in triggeredSQLStatement) but
{{aic.getColumnPosition()}} is greater than that.
Moreover I suspect, based on evidence in logs, if AutoIncremented column *is
not* used in triggeredSQLStatement, it is also not present in afterRow. Yet -
the same call to {{updateAICounters}} is made, with position as in original
whole row.
> NPEx at InternalTriggerExecutionContext.updateAICounters
> --------------------------------------------------------
>
> Key: DERBY-7037
> URL: https://issues.apache.org/jira/browse/DERBY-7037
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.12.1.1, 10.13.1.1, 10.14.2.0, 10.15.1.3
> Environment: Linux, openjdk 8 & 9
> Reporter: Piotr Zygielo
> Priority: Major
>
> AFTER UPDATE trigger fails when the column of source table is autogenerated.
> Bisected issue to fat commit
> [a826375a|https://github.com/apache/derby/commit/a826375a5482ff797e90b93a83b12173964fd181]
> (DERBY-6414). After that change NPEx is observed and update statement is
> forcibly prevented with current connection being closed.
> Logs from example executions: [at
> Travis|https://travis-ci.org/pzrep/derby_npex_trigger/builds/505226771], with
> simple SQLs available on GitHub.
> Edit: as checked on [more complex
> case|https://travis-ci.org/pzrep/derby_npex_trigger/builds/505297229],
> reordering columns is not enough.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)