Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 52613 invoked from network); 25 Apr 2008 15:39:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Apr 2008 15:39:28 -0000 Received: (qmail 69413 invoked by uid 500); 25 Apr 2008 15:39:28 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 69389 invoked by uid 500); 25 Apr 2008 15:39:28 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 69372 invoked by uid 99); 25 Apr 2008 15:39:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 08:39:28 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2008 15:38:52 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7D41C234C108 for ; Fri, 25 Apr 2008 08:35:56 -0700 (PDT) Message-ID: <446988216.1209137756511.JavaMail.jira@brutus> Date: Fri, 25 Apr 2008 08:35:56 -0700 (PDT) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Created: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table -------------------------------------------------------------------------------------------------------------------------------------------------- Key: DERBY-3645 URL: https://issues.apache.org/jira/browse/DERBY-3645 Project: Derby Issue Type: Bug Components: SQL Affects Versions: 10.3.2.2, 10.4.1.4, 10.5.0.0 Reporter: Kathey Marsden The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro. Stack trace is below. Verified back to 10.3 but probably goes back further. s.executeUpdate("CREATE TABLE T_MAIN(" + "ID INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + "V BLOB(590473235) )"); String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)"; PreparedStatement ps; ps = c.prepareStatement(ins1); byte[] bytes = new byte[35000]; for (int i = 0; i < 35000; i++) bytes[i] = (byte) i ; ps.setBytes(1, bytes); ps.executeUpdate(); ps.close(); s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))"); Statement stmt = c.createStatement(); stmt.executeUpdate("INSERT INTO T_COPY SELECT V, V FROM T_MAIN"); ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY"); rs.next(); String v1 = rs.getString(1); String v2 = rs.getString(2); System.out.println("v1:" + v1); System.out.println("v2:" + v2); System.out.println("I am done"); Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re ad more data than was originally stored at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87) at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81) at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320) at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463) at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367) at DoubleInsertInto.main(DoubleInsertInto.java:47) Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha n was originally stored at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11 9) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70) ... 10 more Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11 9) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87) at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403) ... 8 more Caused by: java.io.EOFException at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350) at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328) at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568) at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497) at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459) at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75 9) at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324) at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327) at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282) at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460) at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423) ... 2 more -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.