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 "dragon lee (JIRA)" <ji...@apache.org> on 2009/12/17 03:54:18 UTC

[jira] Created: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

after rename table a to b then create table a statement execute cause null point exception
------------------------------------------------------------------------------------------

                 Key: DERBY-4479
                 URL: https://issues.apache.org/jira/browse/DERBY-4479
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.5.3.0
         Environment: Windows XP SP2

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
            Reporter: dragon lee
            Priority: Minor


step 1 : create original table

		CREATE TABLE BPEL_ARCHIVE (
			EVENT_TIME		CHAR(17) NOT NULL,
			BUSINESS_ID		VARCHAR(100) NOT NULL,
			EVENT_TYPE		INT,
			EVENT_CONTENT	BLOB,
			PRIMARY KEY ( EVENT_TIME )
		)

step 2 : rename original table to backup table
              RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148

step 3 : create original table
             cause error...

java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
        ...................................
Caused by: java.lang.NullPointerException
	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
	... 28 more



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


[jira] Updated: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4479:
--------------------------------------

    Fix Version/s: 10.5.3.1
                       (was: 10.5.4.0)

Changed 10.5 fix version to match the version on the branch.

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.1.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>             Fix For: 10.5.3.1, 10.6.1.0
>
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Updated: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-4479:
----------------------------------

    Assignee: Bryan Pendleton  (was: Mike Matrigali)

reassigning back to original owner.

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.1.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>             Fix For: 10.5.4.0, 10.6.1.0
>
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Commented: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828322#action_12828322 ] 

Dag H. Wanvik commented on DERBY-4479:
--------------------------------------

This patch makes sense to me. +1


> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Resolved: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton resolved DERBY-4479.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0

Thanks Dag and Knut for the reviews and assistance. Committed to the trunk as revision 909176.

Knut, I think your observation about the usefulness of caching DDL statements that
are very unlikely to be re-issued is quite valid, and I think it would be a good
enhancement to pursue in the future. My current itch was to resolve the NPE, so
I decided this this change was reasonable and straightforward and a good incremental
improvement and so I committed it.

I think it would be great if somebody took some time to take a deeper and more
system-wide look at the overall operation of the statement cache mechanism, but
I'm afraid I don't have the time to do that right now so I'm marking this issue as resolved.



> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Commented: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828585#action_12828585 ] 

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

One alternative approach is to stop caching DDL statements that cannot reasonably be expected to be re-executed. The CREATE TABLE statement, for example, cannot be successfully re-executed until the table has been dropped or renamed, in which case the cached statement will have been invalidated anyway. So in effect it just takes up space in the statement cache for no added benefit.

But the patch looks like an improvement, so +1 from me too.

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Updated: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton updated DERBY-4479:
-----------------------------------

    Attachment: patch.diff

Attached is my first proposal at resolving this issue.

As Knut suggested, it appears that the problem involves a missing dependency
between the CREATE TABLE statement and the table that it is creating.

For other types of statements, the dependency of the statement on the table
is generally registered during compilation. For example, here is a snip of code
from CreateIndexNode.bindStatement:

                /* Statement is dependent on the TableDescriptor */
                getCompilerContext().createDependency(td);

However, this isn't quite so easy with the CREATE TABLE statement, because
the table descriptor doesn't exist during compilation, since the table isn't
created until the statement is actually executed.

Therefore, the attached patch registers the dependency at execution time. At
the very end of CreateTableConstantAction.executeConstantAction, there is
some new code added to register a dependency from the CREATE TABLE
statement to the table we have just finished creating.

I haven't yet run the full regression suite, just the repro script. But any feedback
on the patch at this point is most welcome

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Assigned: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton reassigned DERBY-4479:
--------------------------------------

    Assignee: Bryan Pendleton

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Bryan Pendleton
>            Priority: Minor
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Updated: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4479:
--------------------------------------

           Component/s:     (was: JDBC)
                        SQL
      Issue & fix info: [Repro attached]
     Affects Version/s: 10.6.0.0
                        10.0.2.1
                        10.1.1.0
                        10.2.2.0
                        10.3.3.0
                        10.4.2.0
    Bug behavior facts:   (was: [Deviation from standard])

Here's a simplified version of the repro:

ij> create table a (x int not null primary key);
0 rows inserted/updated/deleted
ij> rename table a to b;
0 rows inserted/updated/deleted
ij> create table a (x int not null primary key);
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

Note that the two CREATE TABLE statements must be identical. Even a simple whitespace change makes the second CREATE TABLE succeed:

ij> create table a (x int not null primary key);
0 rows inserted/updated/deleted
ij> rename table a to b;
0 rows inserted/updated/deleted
ij> create table a (  x int not null primary key);
0 rows inserted/updated/deleted

This may indicate that the CREATE TABLE statement is not properly invalidated in the statement cache when RENAME TABLE is performed.

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.0.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Priority: Minor
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Resolved: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali resolved DERBY-4479.
-----------------------------------

    Fix Version/s: 10.5.4.0
       Resolution: Fixed

backported fix from trunk to 10.5.  passed all tests on ubuntu/jdk16.

m105_jdk16:9>svn commit
Sending        .
Sending        java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
Sending        java/testing/org/apache/derbyTesting/functionTests/tests/lang/RenameTableTest.java
Transmitting file data ..
Committed revision 960105.


> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.1.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Mike Matrigali
>            Priority: Minor
>             Fix For: 10.5.4.0, 10.6.1.0
>
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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


[jira] Reopened: (DERBY-4479) after rename table a to b then create table a statement execute cause null point exception

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali reopened DERBY-4479:
-----------------------------------

      Assignee: Mike Matrigali  (was: Bryan Pendleton)

reopening to backport to 10.5.

> after rename table a to b then create table a statement execute cause null point exception
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4479
>                 URL: https://issues.apache.org/jira/browse/DERBY-4479
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.1, 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.1.0
>         Environment: Windows XP SP2
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
> Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
>            Reporter: dragon lee
>            Assignee: Mike Matrigali
>            Priority: Minor
>             Fix For: 10.6.1.0
>
>         Attachments: patch.diff
>
>
> step 1 : create original table
> 		CREATE TABLE BPEL_ARCHIVE (
> 			EVENT_TIME		CHAR(17) NOT NULL,
> 			BUSINESS_ID		VARCHAR(100) NOT NULL,
> 			EVENT_TYPE		INT,
> 			EVENT_CONTENT	BLOB,
> 			PRIMARY KEY ( EVENT_TIME )
> 		)
> step 2 : rename original table to backup table
>               RENAME TABLE BPEL_ARCHIVE TO BPEL_ARCHIVE_200912171148_200912171148
> step 3 : create original table
>              cause error...
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(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.EmbedStatement.execute(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
> 	at world.dragon.service.bpel.event.derby.DerbyArchiveEndpoint.switchTargetTable(DerbyArchiveEndpoint.java:295)
>         ...................................
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.execute.CreateIndexConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateConstraintConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 28 more

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