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-6421) Cast to UDT in CHECK constraint causes NPE or assert failure
Date Mon, 02 Dec 2013 08:49:35 GMT

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

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

The problem is that CastNode's constructor calls ValueNode.setType(), which attempts to bind
the UDT. Since CastNode's constructor can be called during parsing, this means some binding
happens during parsing. The compiler context used when parsing a generation clause or a CHECK
constraint in a DML statement, is not set up to handle binding (for example, it's not setting
current dependent or compilation schema). One might be able to work around it by setting up
a more complete compiler context for the parser, but I think a more correct approach is to
move the binding of the UDT from parse time to bind time.

> Cast to UDT in CHECK constraint causes NPE or assert failure
> ------------------------------------------------------------
>
>                 Key: DERBY-6421
>                 URL: https://issues.apache.org/jira/browse/DERBY-6421
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.10.1.1
>            Reporter: Knut Anders Hatlen
>
> ij version 10.10
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create type typ external name 'java.util.ArrayList' language java;
> 0 rows inserted/updated/deleted
> ij> create table ttt(x int, check (cast(null as typ) is null));
> 0 rows inserted/updated/deleted
> ij> insert into ttt values 1,2,3;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> or with debug build:
> ij> insert into ttt values 1,2,3;
> ERROR XJ001: Java exception: 'ASSERT FAILED no current dependent for compilation: org.apache.derby.shared.common.sanity.AssertFailure'.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message