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/10/19 17:29:59 UTC

[jira] Commented: (DERBY-4410) NullPointerException when USING clause contains all columns in both join tables

    [ https://issues.apache.org/jira/browse/DERBY-4410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767351#action_12767351 ] 

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

The problem appears to be the logic in ResultColumnList.expandAllsAndNameColumns(). It goes through the RCL, removes the asterisks in the list and inserts the columns that the asterisks should expand to. However, it does not adjust the index variable when it removes and adds elements in the middle of the very same list that it's iterating over. When the asterisk expands to more than one column, this makes the loop waste time on looking for result columns to expand inside the list of already expanded columns, but it doesn't actually cause any harm. However, if it expands to an empty column list, the loop will skip the next element in the RCL because the current list element was removed without decrementing the index accordingly.

This makes the statement in the bug description fail because t2.* is never expanded, and it therefore fails with a NullPointerException later when the RCL is processed by code that expect all such columns to have been expanded.

> NullPointerException when USING clause contains all columns in both join tables
> -------------------------------------------------------------------------------
>
>                 Key: DERBY-4410
>                 URL: https://issues.apache.org/jira/browse/DERBY-4410
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> select t1.*, t2.* from t t1 join t t2 using (x);
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> This statement should have raised an exception because both t1.* and t2.* expand to no columns. See DERBY-4407.

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