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 2007/11/06 10:07:50 UTC

[jira] Created: (DERBY-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
----------------------------------------------------------------

                 Key: DERBY-3175
                 URL: https://issues.apache.org/jira/browse/DERBY-3175
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.3.1.4, 10.4.0.0
            Reporter: Knut Anders Hatlen


ij version 10.3
ij> connect 'jdbc:derby:bugdb;create=true';
ij> create table t (
       x varchar(12),
       y varchar(12),
       id int primary key generated by default as identity
);
0 rows inserted/updated/deleted
ij> alter table t drop column y;
0 rows inserted/updated/deleted
ij> insert into t(x) values 'a';
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
        at org.apache.derby.tools.ij.main(Unknown Source)
        at org.apache.derby.iapi.tools.run.main(Unknown Source)
Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
        ... 18 more
Caused by: java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
        at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
        at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
        ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

Posted by "Charlie Hubbard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541318 ] 

Charlie Hubbard commented on DERBY-3175:
----------------------------------------

Sure I can try it out sometime this weekend.  I've never built derby before how would I get the source to build it with?

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

I don't understand this little snippet from SYSCOLUMNSRowFactory.java:

        /* 8th column is AUTOINCREMENTSTART (long) */
        autoincStart = row.getColumn(SYSCOLUMNS_AUTOINCREMENTSTART).getLong();

        /* 9th column is AUTOINCREMENTINC (long) */
        autoincInc = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINC).getLong();

        DataValueDescriptor col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTSTART);
        autoincStart = col.getLong();

        col = row.getColumn(SYSCOLUMNS_AUTOINCREMENTINC);
        autoincInc = col.getLong();

Isn't this doing the same thing twice? Aren't the second group of statements redundant with the first?


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

I propose to submit fixWith3177Case.diff to the trunk fairly soon.  I'm also
interested in merging the fix back to the 10.3 branch, if the trunk change goes well.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

The core of the problem happens when AlterTableConstantAction.dropColumnFromTable 
calls SYSCOLUMNSRowFactory.makeRow (via DataDictionaryImpl.addDescriptorArray).

The relevant dropColumnFromTable code is here:

		// drop the column from syscolumns 
		dd.dropColumnDescriptor(td.getUUID(), columnInfo[ix].name, tc);
		ColumnDescriptor[] cdlArray = 
            new ColumnDescriptor[size - columnDescriptor.getPosition()];

		for (int i = columnDescriptor.getPosition(), j = 0; i < size; i++, j++)
		{
			ColumnDescriptor cd = (ColumnDescriptor) tab_cdl.elementAt(i);
			dd.dropColumnDescriptor(td.getUUID(), cd.getColumnName(), tc);
			cd.setPosition(i);
			cdlArray[j] = cd;
		}
		dd.addDescriptorArray(cdlArray, td,
							  DataDictionary.SYSCOLUMNS_CATALOG_NUM, false, tc);

This code does the following:
1) For the column we're dropping, deletes the corresponding row from SYSCOLUMNS
2) For each column *after* the column we're dropping, deletes that column's
row from SYSCOLUMNS, and accumulates that ColumnDescriptor object into the
cdlArray, updating the ColumnDescriptor to have the new position of that column in the table
3) calls addDescriptorArray to add the new SYSCOLUMNS rows for the columns with
the modified positions.

DataDictionaryImpl.addDescriptorArray then makes a new row for each ColumnDescriptor
with this code:

		for (int index = 0; index < td.length; index++)
		{
			ExecRow row = crf.makeRow(td[index], parent);
			rl[index] = row;
		}

And the crf.makeRow() call arrives at SYSCOLUMNSRowFactory.makeRow.

*HOWEVER*, SYSCOLUMNSRowFactory.makeRow expects that the ColumnDescriptor
will specify how to set the autoincInc, autoincStart, and autoincValue columns in SYSCOLUMNS
via the awkwardly-named getAutoinc_create_or_modify_Start_Increment() value:

		if (autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.CREATE_AUTOINCREMENT ||
				autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE)
		{//user is adding an autoinc column or is changing the increment value of autoinc column
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, 
						  new SQLLongint(autoincStart));
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, 
						  new SQLLongint(autoincStart));
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC, 
						  new SQLLongint(autoincInc));
		} else if (autoinc_create_or_modify_Start_Increment == ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE)
		{//user asked for restart with a new value, so don't change increment by and original start
			//with values in the SYSCOLUMNS table. Just record the RESTART WITH value as the
			//next value to be generated in the SYSCOLUMNS table
			ColumnDescriptor  column = (ColumnDescriptor)td;
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, new SQLLongint(autoincStart));
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, new SQLLongint(autoincStart));
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC, new SQLLongint(
					column.getTableDescriptor().getColumnDescriptor(colName).getAutoincInc()));
		}
		else
		{
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE, 
						  new SQLLongint());
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART, 
						  new SQLLongint());
			row.setColumn(SYSCOLUMNS_AUTOINCREMENTINC,
						  new SQLLongint());
		}

But when we are re-adding the column descriptors in AlterTableConstantAction.dropColumnFromTable,
this autoinc_create_or_modify_Start_Increment value is not set, and so the makeRow() code
falls into the "else" block above, and resets the autoincement fields to 0, thus
corrupting the SYSCOLUMNS row.

I suspect the fix is as simple as forcing a value of ColumnDefinitionNode.CREATE_AUTOINCREMENT
when re-adding the ColumnDescriptors; I'll try this fix in a little while and report back on the results.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: d3175_codeChangeOnly.diff

Attached is d3175_codeChangeOnly.diff, which is not for commit. This change appears to fix the bug. I intend to work up a more complete patch proposal, incorporating Knut's test case as a regression test. I also intend to see whether this code change affects the repro script given in DERBY-3177 and if so I'll link the two issues and include that reproduction script in the regression test as well.

In the meantime, feedback and suggestions about the analysis or the code change are most welcome.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

Posted by "Charlie Hubbard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541218 ] 

Charlie Hubbard commented on DERBY-3175:
----------------------------------------

I'm actually encountering this issue as well as 1377, but it's intermittent.  I haven't dropped a column that occurs before an primary key column, but it fails periodically after inserting lots of data.  It doesn't fail every time.  It usually recovers.  Just thought I'd mention it.

So does this mean we can expect a new version for 10.3 to fix this issue?

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton reassigned DERBY-3175:
--------------------------------------

    Assignee: Bryan Pendleton

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Complete regression suite was clean for preserveAutoincValue.diff


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Knut, good catch on the start value; I'll have a look at that right away.

Charlie, you can learn about building Derby from source here:
http://db.apache.org/derby/dev/derby_source.html

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: preserveFixWithComments.diff

Thanks Knut! Attachment 'preserveFixWithComments.diff' includes
the braces to improve readability in AlterTableConstantAction, and
also adds comments to a number of the code changes.

I intend to commit this fix to the trunk.

Thanks all for the reviews and testing.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 more

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


[jira] Closed: (DERBY-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Knut Anders Hatlen closed DERBY-3175.
-------------------------------------


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>             Fix For: 10.3.2.1, 10.4.0.0
>
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, merge10_3.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

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

> So does this mean we can expect a new version for 10.3 to fix this issue?

There's already a 10.3 maintenance release scheduled. Hopefully, we'll get a fix into that release. Please see http://wiki.apache.org/db-derby/DerbyTenThreeTwoRelease for details about the release.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: fixWithTest.diff

Attached is "fixWithTest.diff", which incorporates Knut's example from
the bug description into the altertable.sql regression test.

I've run the altertable.sql regression test, but haven't run the full test suites.



> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Resetting the next-value counter is occurring in the makeRow() code that I quoted in my earlier comment. Pay particular attention to these lines:

                        row.setColumn(SYSCOLUMNS_AUTOINCREMENTVALUE,
                                                  new SQLLongint(autoincStart));
                        row.setColumn(SYSCOLUMNS_AUTOINCREMENTSTART,
                                                  new SQLLongint(autoincStart));

Note that 'autoincStart' is used for *both* the 'start' column of SYSCOLUMNS and the 'value' column.

Also, note that when we build a ColumnDescriptor from a SYSCOLUMNS row, in buildDescriptor(),
we intentionally omit the AUTOINCREMENTVALUE from the ColumnDescriptor object:

/* 7th column is AUTOINCREMENTVALUE, not cached in descriptor (long) */

So we don't even have the previous counter value available at the time that we make the new row.

More study is needed.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

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

Bryan, preserveAutoincValue.diff looks good. +1 to commit. (nit: the if statement in AlterTableConstantAction would perhaps have been clearer if it used braces, since it spans multiple lines)

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Excellent! That is exactly the symptom that I see with the trunk, so I believe
that you have set up your environment successfully.

None of the patches have been committed yet, so yes, you have to apply the
patch of interest manually before you build the code. Please try 'preserveAutoincValue.diff',
as it is the most recent and most complete patch proposal.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: preserveAutoincValue.diff

Attached is preserveAutoincValue.diff, which addresses the new variant 
problem that Knut found. This patch uses technique #1 from my previous 
comment; that is, it adds an autoincValue field to the ColumnDescriptor
object, reads that value in from the SYSCOLUMNS row in buildDescriptor,
and sets that value into the SYSCOLUMNS row in makeRow.

The test case is also modified as Knut suggested to verify that the
autoincrement value is properly preserved by the drop column command.

I've run lang/altertable.sql successfully with the new patch. I'll run the
full regression suite overnight and report back with any other problems.

Please have a look at preserveAutoincValue.diff if you have a chance.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: merge10_3.diff

There was a minor conflict on SYSCOLUMNSRowFactory.java
when merging to the 10.3 line. Attached is merge10_3.diff
showing the intended patch to the 10.3 line after the conflict is resolved.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, merge10_3.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Attachment: fixWith3177Case.diff

Attached is "fixWith3177Case.diff", a patch proposal.

I believe that this patch proposal is ready for review, and I
believe that it will resolve both DERBY-3175 and DERBY-3177.

Please have a look at the patch and let us know your comments.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

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

Hi Bryan,
I downloaded the patch and it indeed fixes the problem I reported. However, it seems to reset the counter which keeps track of the next identity value to be generated. Please see the modified repro script below:

ij> create table d3175 (x varchar(12), y varchar(12),
id int primary key generated by default as identity);
0 rows inserted/updated/deleted
ij> insert into d3175(x) values 'a';
1 row inserted/updated/deleted
ij> alter table d3175 drop column y;
0 rows inserted/updated/deleted
ij> insert into d3175(x) values 'b';
ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL071109094158840' defined on 'D3175'.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Knut Anders Hatlen updated DERBY-3175:
--------------------------------------

    Attachment: bug.sql

Uploading repro script.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>         Attachments: bug.sql
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Here are 3 possible ways to ensure that the autoincrementValue is preserved during the drop column:

1) Add autoincrementValue to ColumnDescriptor. Change SYSCOLUMNS.buildDescriptor to
retrieve the autoincrementValue from the SYSCOLUMNS row. Change SYSCOLUMNS.makeRow
to set the autoincrementValue in SYSCOLUMNS from the ColumnDescriptor's value. Change
any other places that create a ColumnDescriptor to initialize the autoincrementValue to match
autoincrementStart.

2) Change SYSCOLUMNS.makeRow to take a new 3rd argument: autoincrementValue. Change
AlterTableCOnstantAction's drop column logic so that it fetches the old value of the
autoincrementValue from the SYSCOLUMNS row before it deletes it, then passes that old value
to the makeRow call when adding back the column descriptor. I don't really like this solution,
but I thought of it so I'm recording it here.

3) Change AlterTableConstantAction's  drop column logic so that it doesn't drop-and-re-add
all the subsequent column descriptors in order to change their positions, but instead issues
an UPDATE operation on those column descriptors to decrement their column number field.

Technique #1 seems pretty straightforward, it's just a bunch of code grunging. It does make the
ColumnDescriptor object instance slightly larger in memory.

Technique #3 seems appealing, because if all we want to change about a particular
SYSCOLUMNS row is the column number, why should we have to delete and re-add the
SYSCOLUMNS row in order to make that change? It doesn't appear that the column number
field in SYSCOLUMNS is indexed, so I don't think there should be any index complexity.

If I can find some example code for one of the other system catalogs which issues an UPDATE
rather than a DROP and an INSERT, I'll try to implement technique #3 modelled on that.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

Posted by "Charlie Hubbard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541670 ] 

Charlie Hubbard commented on DERBY-3175:
----------------------------------------

I finally built derby with the patches.  I tested the bug.sql on it before patching it and received the assertion problem I posted earlier.  I then patched the source code and retested with bug.sql and it completed successfully.  I copied the files over and tried it out on my environment, and unfortunately, I still experienced the issue.  I don't know if this is the same exception as before, but it looks like it:

Any ideas?

2007-11-11 18:35:08,224 [Mail loader] WARN  org.hibernate.util.JDBCExceptionReporter  - SQL Error: 0, SQLState: XJ001
2007-11-11 18:35:08,224 [Mail loader] ERROR org.hibernate.util.JDBCExceptionReporter  - Java exception: ': java.lang.NullPointerException'.
2007-11-11 18:35:08,240 [Mail loader] ERROR com.emailarchive.demon.MailIndexer  - could not execute query
org.hibernate.exception.GenericJDBCException: could not execute query
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.loader.Loader.doList(Loader.java:2223)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
	at org.hibernate.loader.Loader.list(Loader.java:2099)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
	at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
	at com.emailarchive.web.model.EmailAddressDao.createIfNotExists(EmailAddressDao.java:21)
	at com.emailarchive.web.model.MessageDao.createEmailIfNotExists(MessageDao.java:124)
	at com.emailarchive.web.model.MessageDao.create(MessageDao.java:111)
	at com.emailarchive.demon.MailIndexer.process(MailIndexer.java:49)
	at com.emailarchive.demon.MailDemonLoader.saveMessages(MailDemonLoader.java:89)
	at com.emailarchive.demon.MailDemonLoader.archiveMessages(MailDemonLoader.java:57)
	at com.emailarchive.demon.MailDemonLoader.run(MailDemonLoader.java:41)
	at java.util.TimerThread.mainLoop(Timer.java:512)
	at java.util.TimerThread.run(Timer.java:462)
Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1573)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1293)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1652)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java:275)
	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
	at org.hibernate.loader.Loader.doQuery(Loader.java:674)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
	at org.hibernate.loader.Loader.doList(Loader.java:2220)
	... 17 more
Caused by: java.lang.NullPointerException
	at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finishAndRTS(BasicNoPutResultSetImpl.java:634)
	at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finish(BasicNoPutResultSetImpl.java:607)
	at org.apache.derby.impl.sql.execute.BaseActivation.close(BaseActivation.java:351)
	at org.apache.derby.impl.sql.GenericActivationHolder.execute(GenericActivationHolder.java:304)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:368)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
	... 24 more



> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

derbyall and junit suites.All runs on the 10.3 branch with the patch were clean.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, merge10_3.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

In the trunk, with a Sane build, I see the following instead of the NPE:

ij> insert into t(x) values 'a';
ERROR XJ001: Java exception: 'ASSERT FAILED If column is not autoinc and have defaultInfo, isDefaultValueAutoinc can not be true: org.apache.derby.shared.common.sanity.AssertFailure'.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>         Attachments: bug.sql
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton updated DERBY-3175:
-----------------------------------

    Derby Info: [Patch Available]

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Committed preserveFixWithComments.diff to the trunk as revision 594727.

After we get a bit of experience with this change in the trunk, I'll investigate merging it back to 10.3.



> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

The *order* of the column definitions in the CREATE TABLE statement is relevant. If I reverse the order of the 'y' and 'id' columns so that the CREATE TABLE statement reads:

create table t (
       x varchar(12),
       id int primary key generated by default as identity,
       y varchar(12)
); 

then the bug does not reproduce.


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>         Attachments: bug.sql
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Hi Charlie, thanks for the update! Is there any way for you to verify whether the patch
attached to this issue affects your symptoms? Can you build a modified version of 10.3
with this change and try it out in your test environment? That would be very helpful.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

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

Charlie, the exception you're seeing now looks more like DERBY-3197. It would be great if you could run with derby.language.logStatementText=true and post the contents of derby.log on that issue.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton commented on DERBY-3175:
----------------------------------------

Except for a strange failure in lang/triggerGeneral, all the regression results were
clean. I believe that the triggerGeneral error is unrelated, and is due to some sort
of configuration error in my environment.

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

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

Bryan Pendleton resolved DERBY-3175.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0
                   10.3.1.5
       Derby Info:   (was: [Patch Available])

No issues appear to have arisen with this change on the trunk in the last 48 hours,
and my merge and build/test results with 10.3 were very clean, so I've committed
the merged patch to the 10.3 branch as subversion revision 595408.

I'm a bit concerned about DERBY-3177. I thought the two issues were the same,
but Charlie reported that the DERBY-3175 changes didn't improve his results
with DERBY-3177. Perhaps I was premature to link the issues as duplicates.

I believe this issue is resolved, though. Thanks again to everyone for the help!


> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>             Fix For: 10.3.1.5, 10.4.0.0
>
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, merge10_3.diff, preserveAutoincValue.diff, preserveFixWithComments.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 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-3175) NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN

Posted by "Charlie Hubbard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541590 ] 

Charlie Hubbard commented on DERBY-3175:
----------------------------------------

I pulled down the source from the 10.3 branch.  Built the code, packaged the jars, and ran the bug.sql script in the ij tool.  Here is what I saw:

D:\dev\db-derby-10.3-src>java -cp jars/sane/derby.jar;jars/sane/derbytools.jar org.apache.derby.tools.ij d:\temp\bug.sql
ij version 10.3
ij> connect 'jdbc:derby:bugdb;create=true';
ij> create table t (
       x varchar(12),
       y varchar(12),
       id int primary key generated by default as identity
);
0 rows inserted/updated/deleted
ij> alter table t drop column y;
0 rows inserted/updated/deleted
ij> insert into t(x) values 'a';
ERROR XJ001: Java exception: 'ASSERT FAILED If column is not autoinc and have defaultInfo, isDefaultValueAutoinc can not be true: org.apache.derby.shared.common.sanity.AssertFailure'.
ij>
D:\dev\db-derby-10.3-src>

Did I do something wrong?  Are the patches attached to this bug committed in the 10.3 branch?  Or do I have to apply these patches manually before I build the project in order to get the fixes?

Charlie

> NullPointerException on INSERT after ALTER TABLE ... DROP COLUMN
> ----------------------------------------------------------------
>
>                 Key: DERBY-3175
>                 URL: https://issues.apache.org/jira/browse/DERBY-3175
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: bug.sql, d3175_codeChangeOnly.diff, fixWith3177Case.diff, fixWithTest.diff, preserveAutoincValue.diff
>
>
> ij version 10.3
> ij> connect 'jdbc:derby:bugdb;create=true';
> ij> create table t (
>        x varchar(12),
>        y varchar(12),
>        id int primary key generated by default as identity
> );
> 0 rows inserted/updated/deleted
> ij> alter table t drop column y;
> 0 rows inserted/updated/deleted
> ij> insert into t(x) values 'a';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.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.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.Main14.main(Unknown Source)
>         at org.apache.derby.tools.ij.main(Unknown Source)
>         at org.apache.derby.iapi.tools.run.main(Unknown Source)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
>         ... 18 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(Unknown Source)
>         at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
>         ... 11 more

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