db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A B (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-1644) NPE when inserting values to a table that has a column declared as generated by default as identity
Date Mon, 20 Nov 2006 23:36:03 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1644?page=comments#action_12451480 ] 
            
A B commented on DERBY-1644:
----------------------------

Hi Bryan,

I applied the d1644_recursivelyCheck_v1.diff patch to my local codeline and it applied cleanly.
 However, when I tried to run lang/autoincrement.sql the test failed due to an ArrayIndexOutOfBounds
exception.  I was able to reproduce the error on a clean database by executing the following
(pulled from that test):

ij> create table ai_test (x int generated always as identity (start with 2, increment by
2), y int);
0 rows inserted/updated/deleted
ij> insert into ai_test (y) values (1),(2);
ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
	at java.util.Vector.elementAt(Vector.java(Compiled Code))
	at org.apache.derby.impl.sql.compile.QueryTreeNodeVector.elementAt(QueryTreeNodeVector.java:52)
	at org.apache.derby.impl.sql.compile.ResultColumnList.checkStorableExpressions(ResultColumnList.java:890)
	at org.apache.derby.impl.sql.compile.InsertNode.bind(InsertNode.java:419)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:345)
	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:119)
	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:742)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:568)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:321)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:517)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:370)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:268)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:204)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:170)
	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
	at org.apache.derby.tools.ij.main(ij.java:71)

To see if it made any difference I also applied RSN_EnhanceRCL_Simplify_v2.diff to my codeline.
 When I did that things started working correctly again.  This surprised me since I was under
the impression that this second patch was optional--i.e. nice but not required.  Am I overlooking
something here, or is it in fact true that both patches must be applied in order for your
fix to be complete?  I didn't look into it at all but if you could give a quick explanation
of why the second patch is required, that'd be great.

In any event, having applied both patches together I was able to run lang/autoincrement.sql
without problems.  I also verified that without the changes the new tests fail with an NPE,
as expected.

My one minor suggestion is to perhaps add two more test cases to your current scenario:

insert into D1644 (c2) values default, default, default, default;
insert into D1644 (c2, c1) values (default, 128), (default, 129), (default, 131);

The above two INSERTs work as expected when both of your patches have been applied, so this
is not a requirement.  But it might be nice to have the extra test cases, just for safety...


> NPE when inserting values to a table that has a column declared as generated by default
as identity
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1644
>                 URL: http://issues.apache.org/jira/browse/DERBY-1644
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.6
>         Environment: Sun JDK 1.4.2
>            Reporter: Yip Ng
>         Assigned To: Bryan Pendleton
>            Priority: Minor
>         Attachments: d1644_recursivelyCheck_v1.diff, RSN_EnhanceRCL_Simplify_v2.diff,
RSNCommentFixup_v1.diff
>
>
> The following scenario triggers a NullPointerException in statement compilation:
> ij> create table t1 (c1 int, c2 int generated by default as identity);
> 0 rows inserted/updated/deleted
> ij> insert into t1 (c2) values default, 10;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> Stacktrace from derby.log:
> Database Class Loader started - derby.database.classpath=''
> 2006-08-04 06:31:17.235 GMT Thread[main,5,main] (XID = 235), (SESSIONID = 0), (DATABASE
= wombat), (DRDAID = null), Cleanup action starting
> 2006-08-04 06:31:17.235 GMT Thread[main,5,main] (XID = 235), (SESSIONID = 0), (DATABASE
= wombat), (DRDAID = null), Failed Statement is: insert into t1 (c2) values default, 10
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1033)
> 	at org.apache.derby.impl.sql.compile.ResultColumnList.generate(ResultColumnList.java:893)
> 	at org.apache.derby.impl.sql.compile.RowResultSetNode.generate(RowResultSetNode.java:690)
> 	at org.apache.derby.impl.sql.compile.UnionNode.generate(UnionNode.java:589)
> 	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1424)
> 	at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1286)
> 	at org.apache.derby.impl.sql.compile.NormalizeResultSetNode.generate(NormalizeResultSetNode.java:122)
> 	at org.apache.derby.impl.sql.compile.InsertNode.generate(InsertNode.java:764)
> 	at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:232)
> 	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:477)
> 	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
> 	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:567)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:516)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:313)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:478)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
> 	at org.apache.derby.tools.ij.main(ij.java:69)
> sysinfo:
> ------------------ Java Information ------------------
> Java Version:    1.4.2_12
> Java Vendor:     Sun Microsystems Inc.
> Java home:       C:\jdk142\jre
> Java classpath:  classes;.
> OS name:         Windows XP
> OS architecture: x86
> OS version:      5.1
> Java user name:  yip
> Java user home:  C:\Documents and Settings\Administrator
> Java user dir:   C:\derby\trunk
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.4
> --------- Derby Information --------
> JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
> [C:\derby\trunk\classes] 10.2.0.5 alpha - (1)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale :  [English/United States [en_US]]
> Found support for locale: [de_DE]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [es]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [fr]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [it]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [ja_JP]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [ko_KR]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [pt_BR]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [zh_CN]
>          version: 10.2.0.5 alpha - (1)
> Found support for locale: [zh_TW]
>          version: 10.2.0.5 alpha - (1)
> ------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message