db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (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 Fri, 06 Nov 2009 22:14:32 GMT

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


Mime
View raw message