[jira] Created: (DERBY-1528) Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

[jira] Created: (DERBY-1528) Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

by Apache Derby Developers mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
-----------------------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-1528
                 URL: http://issues.apache.org/jira/browse/DERBY-1528
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.1.3.1
            Reporter: Knut Anders Hatlen


When preparing a "INSERT INTO table SELECT FROM (...)" statement,
Derby in some cases throw a NullPointerException or an
AssertFailure. This happens when a '?' occurs in a VALUES statement in
the from list. If one tries to access the table after the
NullPointerException, this exception is thrown:

ERROR 40XT0: An internal error was identified by RawStore module.

Example:

ij> create table t (text varchar(20), len int);
0 rows inserted/updated/deleted
ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
ij> select * from t;
ERROR 40XT0: An internal error was identified by RawStore module.

Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
there is enough information in the query to determine the type of the
parameter even without the cast.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (DERBY-1528) Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

by Apache Derby Developers mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

     [ http://issues.apache.org/jira/browse/DERBY-1528?page=all ]

Knut Anders Hatlen updated DERBY-1528:
--------------------------------------

    Attachment: repro1528_assert.java

Attaching a repro which causes an AssertFailure when running in sane mode (NullPointerException otherwise). This is what it prints:

preparing: insert into t select * from (values ?) v

org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Type is null for column exposedName: SQLCol1
name: SQLCol1
tableName: V
isNameGenerated: true
sourceTableName: null
type: null
columnDescriptor: null
isGenerated: false
isGeneratedForUnmatchedColumnInInsert: false
isGroupingColumn: false
isReferenced: false
isRedundant: false
virtualColumnId: 1
resultSetNumber: -1
dataTypeServices: null
clause: 1

        at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:119)
        at org.apache.derby.impl.sql.compile.ResultColumn.columnTypeAndLengthMatch(ResultColumn.java:1027)
        at org.apache.derby.impl.sql.compile.ResultColumnList.columnTypesAndLengthsMatch(ResultColumnList.java:1599)
        at org.apache.derby.impl.sql.compile.InsertNode.bind(InsertNode.java:449)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:344)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:128)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:82)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:62)
        at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java:92)
        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:712)
        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:556)
        at repro1528_assert.main(repro1528_assert.java:18)

----------

executing: select * from t

ERROR 40XT0: An internal error was identified by RawStore module.
        at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:294)
        at org.apache.derby.impl.store.raw.xact.Xact.setActiveState(Xact.java:1772)
        at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java:1271)
        at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(OpenConglomerate.java:865)
        at org.apache.derby.impl.store.access.heap.Heap.open(Heap.java:614)
        at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:478)
        at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:1315)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:7339)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1532)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1442)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1504)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1456)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java:2379)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2107)
        at org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:300)
        at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:472)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:220)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:158)
        at org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:252)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:344)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:567)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:516)
        at repro1528_assert.main(repro1528_assert.java:27)


> Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: http://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (DERBY-1528) Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

by Apache Derby Developers mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

     [ http://issues.apache.org/jira/browse/DERBY-1528?page=all ]

Knut Anders Hatlen updated DERBY-1528:
--------------------------------------

    Attachment: repro1528_npe.java

Another repro. This one causes a NullPointerException in sane mode as well as in insane mode. Output from the test is included below.

preparing: insert into t select x, length(x) from (values ?) v(x)

java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.bindUnaryOperator(UnaryOperatorNode.java:350)
        at org.apache.derby.impl.sql.compile.UnaryOperatorNode.bindExpression(UnaryOperatorNode.java:316)
        at org.apache.derby.impl.sql.compile.DB2LengthOperatorNode.bindExpression(DB2LengthOperatorNode.java:84)
        at org.apache.derby.impl.sql.compile.ResultColumn.bindExpression(ResultColumn.java:579)
        at org.apache.derby.impl.sql.compile.ResultColumnList.bindExpressions(ResultColumnList.java:558)
        at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:526)
        at org.apache.derby.impl.sql.compile.SelectNode.bindExpressionsWithTables(SelectNode.java:655)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressionsWithTables(DMLStatementNode.java:272)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindResultSetsWithTables(DMLStatementNode.java:196)
        at org.apache.derby.impl.sql.compile.InsertNode.bind(InsertNode.java:242)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:344)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:128)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:82)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:62)
        at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java:92)
        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:712)
        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:556)
        at repro1528_npe.main(repro1528_npe.java:18)

----------

executing: select * from t

ERROR 40XT0: An internal error was identified by RawStore module.
        at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:294)
        at org.apache.derby.impl.store.raw.xact.Xact.setActiveState(Xact.java:1772)
        at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java:1271)
        at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(OpenConglomerate.java:865)
        at org.apache.derby.impl.store.access.heap.Heap.open(Heap.java:614)
        at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:478)
        at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:1315)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:7339)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1532)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1442)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1504)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1456)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java:2379)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2107)
        at org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:300)
        at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:472)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:220)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:158)
        at org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:252)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:344)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:118)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:713)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:567)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:516)
        at repro1528_npe.main(repro1528_npe.java:27)

> Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: http://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Knut Anders Hatlen updated DERBY-1528:
--------------------------------------

    Summary: Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module  (was: Preparing "SELECT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module)

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Kathey Marsden updated DERBY-1528:
----------------------------------

    Derby Categories: [High Value Fix]

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Updated: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Knut Anders Hatlen updated DERBY-1528:
--------------------------------------

    Issue & fix info: [High Value Fix, Repro attached]  (was: [High Value Fix])
             Urgency: Normal

Triaged for 10.5.2.

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Commented: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Dag H. Wanvik commented on DERBY-1528:
--------------------------------------

Does Derby attempt to propagate type information down into subqueries?


> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Commented: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

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

Probably not, but I don't know.

It might be that the SQL standard doesn't allow the query, but it should at least not raise a NullPointerException.

For the record, PostgreSQL accepts the following statement without a cast:

  insert into t select x, length(x) from (values(?)) as v(x)

MySQL does not accept it, but then it doesn't allow any VALUES sub-queries, parameterized or not. It does allow a parameter without an explicit cast with its own corresponding (non-standard) syntax, though:

  insert into t select x, length(x) from (select ? as x) v

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Updated: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Knut Anders Hatlen updated DERBY-1528:
--------------------------------------

    Issue & fix info: [High Value Fix, Repro attached, Workaround attached]  (was: [Repro attached, High Value Fix])

Checked "Workaround attached" since the statement works if the parameter is wrapped in a cast.

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Commented: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

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

Back to the question about whether Derby attempts to propagate type information down into subqueries, it looks as if it might be doing so. For instance, this query works fine:

ij> create table t(x int);
0 rows inserted/updated/deleted
ij> insert into t select * from (values null) v(x);
1 row inserted/updated/deleted

If type information hadn't been propagated into the subquery, I'd expect the untyped null to cause some kind of error.

> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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


[jira] Commented: (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module

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

Reply to Author | View Threaded | Show Only this Message


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

Dag H. Wanvik commented on DERBY-1528:
--------------------------------------

I think the null here should give an error according to the standard..


> Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1528
>                 URL: https://issues.apache.org/jira/browse/DERBY-1528
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1
>            Reporter: Knut Anders Hatlen
>         Attachments: repro1528_assert.java, repro1528_npe.java
>
>
> When preparing a "INSERT INTO table SELECT FROM (...)" statement,
> Derby in some cases throw a NullPointerException or an
> AssertFailure. This happens when a '?' occurs in a VALUES statement in
> the from list. If one tries to access the table after the
> NullPointerException, this exception is thrown:
> ERROR 40XT0: An internal error was identified by RawStore module.
> Example:
> ij> create table t (text varchar(20), len int);
> 0 rows inserted/updated/deleted
> ij> prepare p as 'insert into t select x, length(x) from (values(?)) as v(x)';
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij> select * from t;
> ERROR 40XT0: An internal error was identified by RawStore module.
> Replacing '?' with 'CAST (? AS VARCHAR(20))' fixes the problem, but
> there is enough information in the query to determine the type of the
> parameter even without the cast.

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