You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/04/05 22:33:12 UTC
[jira] Created: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
NullPointerException on CREATE TABLE when generated column depends on another generated column
----------------------------------------------------------------------------------------------
Key: DERBY-4145
URL: https://issues.apache.org/jira/browse/DERBY-4145
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.5.1.0
Reporter: Knut Anders Hatlen
ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696269#action_12696269 ]
Rick Hillegas commented on DERBY-4145:
--------------------------------------
Ported 762520 from trunk to 10.5 branch at subversion revision 762521.
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Attachments: derby-4145-01-aa-forwardReference.diff
>
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas reassigned DERBY-4145:
------------------------------------
Assignee: Rick Hillegas
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rick Hillegas updated DERBY-4145:
---------------------------------
Attachment: derby-4145-01-aa-forwardReference.diff
Attaching derby-4145-01-aa-forwardReference.diff. This changes the way that we find generation clauses which reference other generated columns.
Previously, we bound the generation clauses before looking for illegal references. This failed if a generation clause had a forward reference to another generated column declared later in the table's signature. Now we look for illegal references before binding the generation clauses.
Touches the following files:
M java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
Add a new method so that a generation clause can find the columns it references.
M java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
M java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
M java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Relocate the search for illegal references so that it happens just before we bind the generation clauses.
M java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
Add a test case for this bug.
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Attachments: derby-4145-01-aa-forwardReference.diff
>
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696212#action_12696212 ]
Rick Hillegas commented on DERBY-4145:
--------------------------------------
The bug occurs when a generation clause includes a forward reference to a generated column which is declared later on in the table's signature. The bug occurs because we look for the referenced columns after we bind the generation clauses. When we bind the earlier generated columns, we trip across references to columns which haven't been bound yet. This raises an npe. The fix is to bind the generation clauses after we look for illegal references.
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695911#action_12695911 ]
Knut Anders Hatlen commented on DERBY-4145:
-------------------------------------------
Full stack trace:
java.lang.NullPointerException
at org.apache.derby.impl.sql.compile.BinaryOperatorNode.genSQLJavaSQLTree(BinaryOperatorNode.java:416)
at org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(BinaryOperatorNode.java:329)
at org.apache.derby.impl.sql.compile.BinaryArithmeticOperatorNode.bindExpression(BinaryArithmeticOperatorNode.java:129)
at org.apache.derby.impl.sql.compile.GenerationClauseNode.bindExpression(GenerationClauseNode.java:117)
at org.apache.derby.impl.sql.compile.TableElementList.bindAndValidateGenerationClauses(TableElementList.java:803)
at org.apache.derby.impl.sql.compile.CreateTableNode.bindStatement(CreateTableNode.java:441)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:316)
at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:802)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:505)
at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:177)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
at org.apache.derby.tools.ij.main(ij.java:59)
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Knut Anders Hatlen closed DERBY-4145.
-------------------------------------
Resolution: Fixed
Fix Version/s: 10.6.0.0
10.5.1.1
Thanks, Rick! I've verified that it now works on trunk and on the 10.5 branch. Closing the issue.
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Fix For: 10.5.1.1, 10.6.0.0
>
> Attachments: derby-4145-01-aa-forwardReference.diff
>
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-4145) NullPointerException on CREATE TABLE
when generated column depends on another generated column
Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696264#action_12696264 ]
Rick Hillegas commented on DERBY-4145:
--------------------------------------
Committed derby-4145-01-aa-forwardReference.diff at subversion revision 762520.
> NullPointerException on CREATE TABLE when generated column depends on another generated column
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-4145
> URL: https://issues.apache.org/jira/browse/DERBY-4145
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.1.0
> Reporter: Knut Anders Hatlen
> Assignee: Rick Hillegas
> Attachments: derby-4145-01-aa-forwardReference.diff
>
>
> ij> create table t (c1 int, c2 int, c3 generated always as (c1 + c4), c4 generated always as (-c1));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.