[ 
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.

Reply via email to