[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-22 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: svn-merge.log

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Fix For: 10.15.2.1, 10.16.1.2, 10.17.0.0
>
> Attachments: branches-10.14.diff, bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, svn-merge.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-22 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: (was: svn-merge.log)

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Fix For: 10.15.2.1, 10.16.1.2, 10.17.0.0
>
> Attachments: branches-10.14.diff, bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, svn-merge.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-21 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: svn-merge.log

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Fix For: 10.15.2.1, 10.16.1.2, 10.17.0.0
>
> Attachments: branches-10.14.diff, bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, svn-merge.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-21 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Fix Version/s: 10.15.2.1

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Fix For: 10.15.2.1, 10.16.1.2, 10.17.0.0
>
> Attachments: branches-10.14.diff, bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-21 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: branches-10.14.diff

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Fix For: 10.16.1.2, 10.17.0.0
>
> Attachments: branches-10.14.diff, bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-16 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: 
derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, 
> derby-7144-03-aa-computeRowTemplateAndTrackIdentityColumnsBetter.diff, 
> derby-7144-1.sql, derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, 
> derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-16 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-02-ae-reformat.diff

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, 
> derby-7144-02-ae-reformat.diff, derby-7144-1.sql, derby-7144-2.sql, 
> derby-7144-3.sql, derby-7144-default.sql, derby-7144.sql, derby.log, 
> sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-04 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, 
> derby-7144-01-aa-reformatTemporaryRowHolderImpl.diff, derby-7144-1.sql, 
> derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, derby-7144.sql, 
> derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
>

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-02 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-default.sql

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby-7144-1.sql, 
> derby-7144-2.sql, derby-7144-3.sql, derby-7144-default.sql, derby-7144.sql, 
> derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-01 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-3.sql

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby-7144-1.sql, 
> derby-7144-2.sql, derby-7144-3.sql, derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-01 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-2.sql

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby-7144-1.sql, 
> derby-7144-2.sql, derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-01 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144-1.sql

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby-7144-1.sql, 
> derby-7144.sql, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-08-01 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Attachment: derby-7144.sql

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby-7144.sql, derby.log, 
> sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-7144:
---
Bug behavior facts: Crash,Seen in production  (was: Crash)
  Issue & fix info: Repro attached,Workaround attached

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: bug-demo.zip
bug-demo2.zip

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: (was: bug-demo.zip)

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: (was: bug-demo2.zip)

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Environment: 
Windows 10, JDK 8, Derby 10.14.2.0;
Windows 10, JDK 11, Derby 10.15.2.0;
Windows 10, JDK 17, Derby 10.16.1.1.

  was:
Windows 10; JDK 8; Derby 10.14.2.0;
Windows 10; JDK 11; Derby 10.15.2.0;
Windows 10; JDK 17; Derby 10.16.1.1.


> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10, JDK 8, Derby 10.14.2.0;
> Windows 10, JDK 11, Derby 10.15.2.0;
> Windows 10, JDK 17, Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Affects Version/s: 10.16.1.1
   10.15.2.0

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0, 10.15.2.0, 10.16.1.1
> Environment: Windows 10; JDK 8; Derby 10.14.2.0;
> Windows 10; JDK 11; Derby 10.15.2.0;
> Windows 10; JDK 17; Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: bug-demo2.zip

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: Windows 10; JDK 8; Derby 10.14.2.0;
> Windows 10; JDK 11; Derby 10.15.2.0;
> Windows 10; JDK 17; Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, bug-demo2.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: derby.log

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: Windows 10; JDK 8; Derby 10.14.2.0;
> Windows 10; JDK 11; Derby 10.15.2.0;
> Windows 10; JDK 17; Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, derby.log, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Attachment: sysinfo.out

> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: Windows 10; JDK 8; Derby 10.14.2.0;
> Windows 10; JDK 11; Derby 10.15.2.0;
> Windows 10; JDK 17; Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip, sysinfo.out
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:274)
> at 
> 

[jira] [Updated] (DERBY-7144) MERGE INSERT failing when target has GENERATED INDENTITY column

2022-07-30 Thread Stanimir Stamenkov (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stanimir Stamenkov updated DERBY-7144:
--
Environment: 
Windows 10; JDK 8; Derby 10.14.2.0;
Windows 10; JDK 11; Derby 10.15.2.0;
Windows 10; JDK 17; Derby 10.16.1.1.

  was:
Windows 10; JDK 11; Derby 10.14.0.2.

As far as I've observed the problem persists in Derby 10.15 and 10.16.


> MERGE INSERT failing when target has GENERATED INDENTITY column
> ---
>
> Key: DERBY-7144
> URL: https://issues.apache.org/jira/browse/DERBY-7144
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: Windows 10; JDK 8; Derby 10.14.2.0;
> Windows 10; JDK 11; Derby 10.15.2.0;
> Windows 10; JDK 17; Derby 10.16.1.1.
>Reporter: Stanimir Stamenkov
>Priority: Major
> Attachments: bug-demo.zip
>
>
> _TL;DR:_ The following statement fails (most often) when the target table has 
> a GENERATED BY DEFAULT AS IDENTITY primary key:
> {code:sql}
> MERGE INTO AGGREGATEDATA target
> USING TABLE (AGGREGATE_BULK_DATA()) source
>ON target.CATEGORY = source.CATEGORY
>   AND target.AGGDATE = source.AGGDATE
>  WHEN MATCHED THEN
>   UPDATE SET VALUE = target.VALUE + source.VALUE,
>   ATTIME = CASE WHEN source.ATTIME < target.ATTIME THEN target.ATTIME 
> ELSE source.ATTIME END,
>   AGGCOUNT = target.AGGCOUNT + source.AGGCOUNT
>  WHEN NOT MATCHED THEN
>   INSERT (CATEGORY, VALUE, ATTIME, AGGDATE, AGGCOUNT)
>   VALUES (source.CATEGORY, source.VALUE, source.ATTIME, source.AGGDATE, 
> source.AGGCOUNT)
> {code}
> {noformat}
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:124)
>   at net.example.derby.BugDemo.run(BugDemo.java:242)
>   at net.example.derby.BugDemo.main(BugDemo.java:212)
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>   at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 15 more
> Caused by: java.lang.NullPointerException
>   at 
> org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil.createFormatIds(Unknown
>  Source)
>   at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
>   at 
> org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown
>  Source)
>   at 
> org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.TemporaryRowHolderImpl.insert(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.MatchingClauseConstantAction.bufferThenRow(Unknown
>  Source)
>   at 
> org.apache.derby.impl.sql.execute.MergeResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.MergeResultSet.open(Unknown Source)
>   at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>   at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>   ... 7 more
> {noformat}
> With the debug-version JARs I'm getting:
> {noformat}
> java.sql.SQLException: Java exception: 'ASSERT FAILED row template is null 
> for column[0].: org.apache.derby.shared.common.sanity.AssertFailure'.
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:115)
> at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
> at