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/15 16:30:31 UTC

[jira] Created: (DERBY-4410) NullPointerException during bind when b

NullPointerException during bind when b
---------------------------------------

                 Key: DERBY-4410
                 URL: https://issues.apache.org/jira/browse/DERBY-4410
             Project: Derby
          Issue Type: Bug
            Reporter: Knut Anders Hatlen




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


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

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

Knut Anders Hatlen updated DERBY-4410:
--------------------------------------

    Issue & fix info: [Patch Available, Repro attached]  (was: [Repro attached])

> 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
>         Attachments: adjustIndex.diff, adjustIndexWithTest.diff
>
>
> 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.


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

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

Knut Anders Hatlen updated DERBY-4410:
--------------------------------------

    Summary: NullPointerException when USING clause contains all columns in both join tables  (was: NullPointerException when USING clause contains all columns)

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


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

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ 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.


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

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

Knut Anders Hatlen reassigned DERBY-4410:
-----------------------------------------

    Assignee: Knut Anders Hatlen

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


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

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

Knut Anders Hatlen updated DERBY-4410:
--------------------------------------

    Attachment: adjustIndexWithTest.diff

Thanks for looking at the patch, Bryan!

Regarding the current behaviour, also note that it doesn't re-process all the expanded columns, it always skips the first one in the expanded list, which also suggests that the re-processing of the rest of the columns is unnecessary.

I'm uploading a new patch which changes the space indentation in RCL to tabs and adds a test case in JoinTest. All the regression tests ran cleanly.

> 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
>         Attachments: adjustIndex.diff, adjustIndexWithTest.diff
>
>
> 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.


[jira] Updated: (DERBY-4410) NullPointerException when USING clause contains all columns

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

Knut Anders Hatlen updated DERBY-4410:
--------------------------------------

          Component/s: SQL
          Description: 
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.
     Issue & fix info: [Repro attached]
    Affects Version/s: 10.6.0.0
              Summary: NullPointerException when USING clause contains all columns  (was: NullPointerException during bind when b)

> NullPointerException when USING clause contains all columns
> -----------------------------------------------------------
>
>                 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
>
> 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.


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

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

Bryan Pendleton commented on DERBY-4410:
----------------------------------------

Great find! I remember stepping through this code once and noticing that it
re-processed the columns after expanding them, but it had never occurred
to me that it would have this behavior if the * expanded to an empty set.

Fix looks fine to me, and the comment is quite useful thanks. But maybe the
indentation looks off (spaces vs tabs?)


> 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
>         Attachments: adjustIndex.diff
>
>
> 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.


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

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

Knut Anders Hatlen updated DERBY-4410:
--------------------------------------

    Attachment: adjustIndex.diff

The attached patch appears to fix the problem. It changes the loop so that the index is adjusted after elements have been removed from or added to the RCL. This should fix both the harmless double processing and the problematic skipping of elements.

The patch does not include a regression test, and none of the existsing regression tests have been run yet.

> 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
>         Attachments: adjustIndex.diff
>
>
> 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.


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

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

Knut Anders Hatlen closed DERBY-4410.
-------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.6.0.0
    Issue & fix info: [Repro attached]  (was: [Repro attached, Patch Available])

Committed revision 829034.

> 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
>             Fix For: 10.6.0.0
>
>         Attachments: adjustIndex.diff, adjustIndexWithTest.diff
>
>
> 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.