db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-1528) Preparing "INSERT INTO table SELECT FROM (...)" may cause NullPointerException and subsequent internal errors reported by RawStore module
Date Wed, 03 Jul 2013 14:15:20 GMT

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

Kathey Marsden commented on DERBY-1528:
---------------------------------------

On trunk (10.11) repro1528_assert.java gives an NPE rather than an assert:
Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:
5)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
        ... 11 more
Caused by: java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.BaseTypeCompiler.numberStorable(BaseTypeCompiler.java:305)
        at org.apache.derby.impl.sql.compile.NumericTypeCompiler.numberStorable(NumericTypeCompiler.java:53)
        at org.apache.derby.impl.sql.compile.NumericTypeCompiler.storable(NumericTypeCompiler.java:326)

repro1528_npe gives the same NPE

        at org.apache.derby.impl.sql.compile.ResultColumn.checkStorableExpression(ResultColumn.java:1017)
        at org.apache.derby.impl.sql.compile.ResultColumn.checkStorableExpression(ResultColumn.java:1009)
        at org.apache.derby.impl.sql.compile.ResultColumnList.checkStorableExpressions(ResultColumnList.java:1083)
        at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(InsertNode.java:459)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:403)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:100)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageCon
ctionContext.java:1107)
        at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:133)
        ... 4 more

----------

executing: select * from t

java.sql.SQLNonTransientConnectionException: No current connection.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:77)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:146)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:162)
        at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Util.java:331)
        at org.apache.derby.impl.jdbc.EmbedStatement.checkExecStatus(EmbedStatement.java:1541)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:675)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:640)
        at repro1528_assert.main(repro1528_assert.java:27)
Caused by: java.sql.SQLException: No current connection.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:
5)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)

                
> 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
>              Labels: derby_triage10_5_2
>         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, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message