You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/02/01 12:53:59 UTC

[jira] Commented: (DERBY-4043) NullPointerException executing DELETE against table involved in DELETE CASCADE referential constraint

    [ https://issues.apache.org/jira/browse/DERBY-4043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669372#action_12669372 ] 

Knut Anders Hatlen commented on DERBY-4043:
-------------------------------------------

Have you set derby.language.logQueryPlan to true? If you have, this may be the same issue as DERBY-2353.

I'm able to reproduce this error on the development trunk with a fresh, unencrypted database when I have enabled logging of query plans. It's also reproducible on 10.3.3.0, but not on 10.3.2.1.

> NullPointerException executing DELETE against table involved in DELETE CASCADE referential constraint
> -----------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4043
>                 URL: https://issues.apache.org/jira/browse/DERBY-4043
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.2.0
>         Environment: Windows XP
> Use encrypted, soft-upgraded DB (from v10.3.2.1)
>            Reporter: Chip Hartney
>
> I am incurring a NullPointerException in the DELETE CASCADE logic of v10.4.2.0.  After the error, the connection is lost.
> The following is reproducible in my env in which I have a DB created under v10.3.2.1 being accessed through IJ using the v10.4.2.0 libraries.  (I have not tested against other scenarios.)  Note, however, that variations on this sequence do not recreate the problem...such as leaving off the PK constraints or adding data to the tables before creating the constraints or leaving out the "Entry" record.
> ij> CREATE TABLE "Catalog" ("Id" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "Code" VARCHAR(8) NOT NULL, "Name" VARCHAR(64) NOT NULL, "SeqNo" INTEGER NOT NULL DEFAULT 0);
> 0 rows inserted/updated/deleted
> ij> ALTER TABLE "Catalog" ADD CONSTRAINT "SQL171213084206750" PRIMARY KEY ("Id");
> 0 rows inserted/updated/deleted
> ij> CREATE TABLE "Entry" ("Id" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), "CatalogId" INTEGER NOT NULL, "ProductId" INTEGER NOT NULL, "PageNo" INTEGER NOT NULL, "SeqNo" INTEGER NOT NULL);
> 0 rows inserted/updated/deleted
> ij> ALTER TABLE "Entry" ADD CONSTRAINT "SQL171213084210150" PRIMARY KEY ("Id");
> 0 rows inserted/updated/deleted
> ij> ALTER TABLE "Entry" ADD CONSTRAINT "Entry_FK_CatalogId1" FOREIGN KEY ("CatalogId") REFERENCES "Catalog" ("Id") ON DELETE CASCADE ON UPDATE NO ACTION;
> 0 rows inserted/updated/deleted
> ij> insert into "Catalog" ("Code", "Name") values ('a', 'a');
> 1 row inserted/updated/deleted
> ij> insert into "Entry" ("CatalogId", "ProductId", "PageNo", "SeqNo") values (1, 1, 1, 1);
> 1 row inserted/updated/deleted
> ij> delete from "Catalog";
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from "Catalog";
> ERROR 08003: No current connection.
> The stack trace from derby.log is:
> 2009-01-31 20:12:48.890 GMT Thread[main,5,main] (XID = 8949829), (SESSIONID = 0), (DATABASE = OrderEntryDB), (DRDAID = null), Cleanup action starting
> 2009-01-31 20:12:48.890 GMT Thread[main,5,main] (XID = 8949829), (SESSIONID = 0), (DATABASE = OrderEntryDB), (DRDAID = null), Failed Statement is: delete from "Catalog"
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.NoRowsResultSetImpl.close(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteCascadeResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteCascadeResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteCascadeResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> 	at org.apache.derby.tools.ij.main(Unknown Source)
> 2009-01-31 20:12:48.890 GMT Thread[main,5,main] Equally severe exception raised during cleanup (ignored) null
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.NoRowsResultSetImpl.close(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteCascadeResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.DeleteCascadeResultSet.cleanUp(Unknown Source)
> 	at org.apache.derby.impl.sql.conn.GenericStatementContext.cleanupOnError(Unknown Source)
> 	at org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown Source)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> 	at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> 	at org.apache.derby.tools.ij.main(Unknown Source)
> Cleanup action completed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.