[jira] [Comment Edited] (DERBY-7145) MERGE UPDATE failing: Restore of a serializable or SQLData object of class , attempted to read more data than was originally stored

2022-10-10 Thread Stanimir Stamenkov (Jira)


[ 
https://issues.apache.org/jira/browse/DERBY-7145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17615192#comment-17615192
 ] 

Stanimir Stamenkov edited comment on DERBY-7145 at 10/10/22 4:16 PM:
-

FWIW, here are simplified test cases:

{code:sql|title=Only UPDATEs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
INSERT INTO targetData VALUES (10, 3), (20, 3), (30, 3), (40, 3), (50, 3), (60, 
3);

CREATE TABLE sourceData (ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2;
{code}

{code:sql|title=Only INSERTs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);

CREATE TABLE sourceData (ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}

So it doesn't appear MERGE UPDATE-specific.


was (Author: stanio):
FWIW, here are simplified test cases:

{code:sql|title=Only UPDATEs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
INSERT INTO targetData VALUES (10, 3), (20, 3), (30, 3), (40, 3), (50, 3), (60, 
3);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2;
{code}

{code:sql|title=Only INSERTs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}

So it doesn't appear MERGE UPDATE-specific.

> MERGE UPDATE failing: Restore of a serializable or SQLData object of class , 
> attempted to read more data than was originally stored
> ---
>
> Key: DERBY-7145
> URL: https://issues.apache.org/jira/browse/DERBY-7145
> 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-demo3.zip, derby.log, derby2.log, sysinfo.txt
>
>
> _\[May be related to DERBY-7144.\]_
> [^bug-demo3.zip] – a revision of {{bug-demo2.zip}} in DERBY-7144.  Extract;  
> Copy the Derby JARs to a {{lib/}} subdirectory; Compile:
> {noformat}
> $ mkdir classes
> $ javac -d classes src/net/example/derby/*.java
> {noformat}
> Run to see the problem:
> {noformat}
> $ java -cp "classes;lib/*" net.example.derby.BugDemo -seed -merge -print
> {noformat}
> {noformat}
> Exception in thread "main" java.sql.SQLException: Restore of a serializable 
> or SQLData object of class , attempted to read more data than was originally 
> stored
>   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.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:125)
>   at net.example.derby.BugDemo.run(BugDemo.java:254)
>   at net.example.derby.BugDemo.main(BugDemo.java:224)
> Caused by: ERROR XSDA7: Restore of a serializable or SQLData object of class 
> , attempted to read more data than was originally stored
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> 

[jira] [Comment Edited] (DERBY-7145) MERGE UPDATE failing: Restore of a serializable or SQLData object of class , attempted to read more data than was originally stored

2022-10-10 Thread Stanimir Stamenkov (Jira)


[ 
https://issues.apache.org/jira/browse/DERBY-7145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17615192#comment-17615192
 ] 

Stanimir Stamenkov edited comment on DERBY-7145 at 10/10/22 4:15 PM:
-

FWIW, here are simplified test cases:

{code:sql|title=Only UPDATEs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
INSERT INTO targetData VALUES (10, 3), (20, 3), (30, 3), (40, 3), (50, 3), (60, 
3);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2;
{code}

{code:sql|title=Only INSERTs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}

So it doesn't appear MERGE UPDATE-specific.


was (Author: stanio):
FWIW, here's are simplified test cases:

{code:sql|title=Only UPDATEs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
INSERT INTO targetData VALUES (10, 3), (20, 3), (30, 3), (40, 3), (50, 3), (60, 
3);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2;
{code}

{code:sql|title=Only INSERTs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}

So it doesn't appear MERGE UPDATE-specific.

> MERGE UPDATE failing: Restore of a serializable or SQLData object of class , 
> attempted to read more data than was originally stored
> ---
>
> Key: DERBY-7145
> URL: https://issues.apache.org/jira/browse/DERBY-7145
> 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-demo3.zip, derby.log, derby2.log, sysinfo.txt
>
>
> _\[May be related to DERBY-7144.\]_
> [^bug-demo3.zip] – a revision of {{bug-demo2.zip}} in DERBY-7144.  Extract;  
> Copy the Derby JARs to a {{lib/}} subdirectory; Compile:
> {noformat}
> $ mkdir classes
> $ javac -d classes src/net/example/derby/*.java
> {noformat}
> Run to see the problem:
> {noformat}
> $ java -cp "classes;lib/*" net.example.derby.BugDemo -seed -merge -print
> {noformat}
> {noformat}
> Exception in thread "main" java.sql.SQLException: Restore of a serializable 
> or SQLData object of class , attempted to read more data than was originally 
> stored
>   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.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:125)
>   at net.example.derby.BugDemo.run(BugDemo.java:254)
>   at net.example.derby.BugDemo.main(BugDemo.java:224)
> Caused by: ERROR XSDA7: Restore of a serializable or SQLData object of class 
> , attempted to read more data than was originally stored
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> 

[jira] [Comment Edited] (DERBY-7145) MERGE UPDATE failing: Restore of a serializable or SQLData object of class , attempted to read more data than was originally stored

2022-10-10 Thread Stanimir Stamenkov (Jira)


[ 
https://issues.apache.org/jira/browse/DERBY-7145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17615192#comment-17615192
 ] 

Stanimir Stamenkov edited comment on DERBY-7145 at 10/10/22 4:14 PM:
-

FWIW, here's are simplified test cases:

{code:sql|title=Only UPDATEs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
INSERT INTO targetData VALUES (10, 3), (20, 3), (30, 3), (40, 3), (50, 3), (60, 
3);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2;
{code}

{code:sql|title=Only INSERTs}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}

So it doesn't appear MERGE UPDATE-specific.


was (Author: stanio):
FWIW, here's a simplified test case:

{code:sql}
CREATE TABLE targetData (ID BIGINT, CS BIGINT DEFAULT 1);
--INSERT INTO targetData VALUES (30, 3);

CREATE TABLE sourceData(ID BIGINT);
INSERT INTO sourceData VALUES (10), (20), (30), (40), (50), (60);

MERGE INTO targetData target USING sourceData source ON target.ID = source.ID
WHEN MATCHED THEN UPDATE SET CS = 2
WHEN NOT MATCHED THEN INSERT (ID) VALUES (source.ID);
{code}


> MERGE UPDATE failing: Restore of a serializable or SQLData object of class , 
> attempted to read more data than was originally stored
> ---
>
> Key: DERBY-7145
> URL: https://issues.apache.org/jira/browse/DERBY-7145
> 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-demo3.zip, derby.log, derby2.log, sysinfo.txt
>
>
> _\[May be related to DERBY-7144.\]_
> [^bug-demo3.zip] – a revision of {{bug-demo2.zip}} in DERBY-7144.  Extract;  
> Copy the Derby JARs to a {{lib/}} subdirectory; Compile:
> {noformat}
> $ mkdir classes
> $ javac -d classes src/net/example/derby/*.java
> {noformat}
> Run to see the problem:
> {noformat}
> $ java -cp "classes;lib/*" net.example.derby.BugDemo -seed -merge -print
> {noformat}
> {noformat}
> Exception in thread "main" java.sql.SQLException: Restore of a serializable 
> or SQLData object of class , attempted to read more data than was originally 
> stored
>   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.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:125)
>   at net.example.derby.BugDemo.run(BugDemo.java:254)
>   at net.example.derby.BugDemo.main(BugDemo.java:224)
> Caused by: ERROR XSDA7: Restore of a serializable or SQLData object of class 
> , attempted to read more data than was originally stored
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:170)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:75)
>   ... 13 more
> Caused by: java.io.EOFException
>   at 
> org.apache.derby.iapi.services.io.ArrayInputStream.readLong(ArrayInputStream.java:323)
>   at 
> 

[jira] [Comment Edited] (DERBY-7145) MERGE UPDATE failing: Restore of a serializable or SQLData object of class , attempted to read more data than was originally stored

2022-08-01 Thread Stanimir Stamenkov (Jira)


[ 
https://issues.apache.org/jira/browse/DERBY-7145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17573897#comment-17573897
 ] 

Stanimir Stamenkov edited comment on DERBY-7145 at 8/1/22 7:46 PM:
---

{quote}
_\[May be related to DERBY-7144.\]_
{quote}

Doesn't appear affected by the presence or absence of GENERATED AS IDENTITY 
column – if I remove the ID column from the original demo, and declare instead 
({{sqlStatements.properties}}):

{code:sql|title=TABLE AGGREGATEDATA}
  PRIMARY KEY (AGGDATE, CATEGORY)
{code}

the problem is still observed.


was (Author: stanio):
{quote}
_\[May be related to DERBY-7144.\]_
{quote}

Doesn't appear affected by the presence or absence of GENERATED AS IDENTITY 
column – if I remote the ID column from the original demo, and declare instead 
({{sqlStatements.properties}}):

{code:sql|title=TABLE AGGREGATEDATA}
  PRIMARY KEY (AGGDATE, CATEGORY)
{code}

the problem is still observed.

> MERGE UPDATE failing: Restore of a serializable or SQLData object of class , 
> attempted to read more data than was originally stored
> ---
>
> Key: DERBY-7145
> URL: https://issues.apache.org/jira/browse/DERBY-7145
> 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-demo3.zip, derby.log, derby2.log, sysinfo.txt
>
>
> _\[May be related to DERBY-7144.\]_
> [^bug-demo3.zip] – a revision of {{bug-demo2.zip}} in DERBY-7144.  Extract;  
> Copy the Derby JARs to a {{lib/}} subdirectory; Compile:
> {noformat}
> $ mkdir classes
> $ javac -d classes src/net/example/derby/*.java
> {noformat}
> Run to see the problem:
> {noformat}
> $ java -cp "classes;lib/*" net.example.derby.BugDemo -seed -merge -print
> {noformat}
> {noformat}
> Exception in thread "main" java.sql.SQLException: Restore of a serializable 
> or SQLData object of class , attempted to read more data than was originally 
> stored
>   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.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431)
>   at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>   at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
>   at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
>   at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(EmbedPreparedStatement.java:320)
>   at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:309)
>   at net.example.derby.BugDemo.mergeData(BugDemo.java:125)
>   at net.example.derby.BugDemo.run(BugDemo.java:254)
>   at net.example.derby.BugDemo.main(BugDemo.java:224)
> Caused by: ERROR XSDA7: Restore of a serializable or SQLData object of class 
> , attempted to read more data than was originally stored
>   at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:170)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:75)
>   ... 13 more
> Caused by: java.io.EOFException
>   at 
> org.apache.derby.iapi.services.io.ArrayInputStream.readLong(ArrayInputStream.java:323)
>   at 
> org.apache.derby.iapi.types.SQLLongint.readExternal(SQLLongint.java:184)
>   at 
> org.apache.derby.iapi.types.DataType.readExternalFromArray(DataType.java:276)
>   at 
> org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5676)
>   at 
> org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1514)
>   at 
> org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:450)
>   at 
> org.apache.derby.impl.store.raw.data.CachedPage.fetchFromSlot(CachedPage.java:53)
>   at 
>