[jira] Created: (DERBY-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

View: New views
6 Messages — Rating Filter:   Alert me  

[jira] Created: (DERBY-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
-------------------------------------------------------------------------------------------

                 Key: DERBY-4425
                 URL: https://issues.apache.org/jira/browse/DERBY-4425
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.5.3.0, 10.5.1.1, 10.6.0.0
            Reporter: Knut Anders Hatlen


This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.

ij> create table t1(x int);
0 rows inserted/updated/deleted
ij> create table t2(x int);
0 rows inserted/updated/deleted
ij> create table t3(x int, y generated always as (2*x));
0 rows inserted/updated/deleted
ij> insert into t3(x) select * from t1 union select * from t2;
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-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

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

java.lang.NullPointerException
        at org.apache.derby.iapi.types.DataTypeDescriptor.isExactTypeAndLengthMatch(DataTypeDescriptor.java:954)
        at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(ResultColumn.java:1020)
        at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(ResultColumnList.java:1696)
        at org.apache.derby.impl.sql.compile.ResultSetNode.columnTypesAndLengthsMatch(ResultSetNode.java:934)
        at org.apache.derby.impl.sql.compile.UnionNode.addNewNodes(UnionNode.java:411)
        at org.apache.derby.impl.sql.compile.UnionNode.modifyAccessPaths(UnionNode.java:361)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:323)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:302)
        at org.apache.derby.impl.sql.compile.DMLModStatementNode.optimizeStatement(DMLModStatementNode.java:1736)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:381)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:90)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:828)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)

> NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4425
>                 URL: https://issues.apache.org/jira/browse/DERBY-4425
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>
> This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, y generated always as (2*x));
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> 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-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/DERBY-4425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton reassigned DERBY-4425:
--------------------------------------

    Assignee: Bryan Pendleton

> NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4425
>                 URL: https://issues.apache.org/jira/browse/DERBY-4425
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>
> This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, y generated always as (2*x));
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> 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-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/DERBY-4425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton updated DERBY-4425:
-----------------------------------

    Attachment: checkIsGenerated.diff

Attached is a patch proposal. This patch is quite similar to the idea in DERBY-4419, but
this patch uses resultColumn.isGeneratedForUnmatchedColumnInInsert() rather than
the isAutoincrementGenerated() method.

The patch includes a regression test, but I haven't run the entire suite, just the GeneratedColumnsTest.

It appears that the use of isGeneratedForUnmanagedColumnInsert not only fixes
this problem, but also fixes DERBY-4419, so I'm going to return to that issue and
see if I can get a single code patch (although with different regression tests) that fixes both problems.


> NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4425
>                 URL: https://issues.apache.org/jira/browse/DERBY-4425
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: checkIsGenerated.diff
>
>
> This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, y generated always as (2*x));
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> 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] Resolved: (DERBY-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/DERBY-4425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton resolved DERBY-4425.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0

Committed the regression test change to the trunk as revision 831319.

The code change was committed as part of revision 831304, for DERBY-4419.


> NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4425
>                 URL: https://issues.apache.org/jira/browse/DERBY-4425
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>             Fix For: 10.6.0.0
>
>         Attachments: checkIsGenerated.diff
>
>
> This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, y generated always as (2*x));
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> 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-4425) NullPointerException with INSERT INTO ... from UNION and columns generated from expressions

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

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

DERBY-4442 fixed a family of INSERT bugs, including this one, making the original fix for this issue unnecessary. The fix was therefore backed out in revision 888311, but the tests are still part of the regression test suite.

> NullPointerException with INSERT INTO ... from UNION and columns generated from expressions
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4425
>                 URL: https://issues.apache.org/jira/browse/DERBY-4425
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>             Fix For: 10.6.0.0
>
>         Attachments: checkIsGenerated.diff
>
>
> This bug is similar to DERBY-4419, only that it uses columns that are auto-generated from expressions and not identity columns. The proposed fix for DERBY-4419 only addresses the case with an identity column.
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> create table t3(x int, y generated always as (2*x));
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> 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.