You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2013/12/02 18:48:40 UTC

[jira] [Updated] (DERBY-6421) Cast to UDT in CHECK constraint causes NPE or assert failure

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

Knut Anders Hatlen updated DERBY-6421:
--------------------------------------

    Attachment: d6421-1a.diff

The attached patch fixes the assert failure and adds a regression test case that verifies the fix.

As far as I could see, CastNode was the only place ValueNode.setType() was called before the bind phase, so I think it's ok to preserve the bind logic in setType(). Instead, I changed CastNode so that it doesn't call setType() from the constructor if the target type is a UDT. Now CastNode's constructor just stores the unbound type descriptor in a field and waits until bindExpression() or bindCastNodeOnly() is called before it actually binds it.

All regression tests passed with the patch.

> 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
>            Assignee: Knut Anders Hatlen
>         Attachments: d6421-1a.diff
>
>
> 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)