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/11/08 10:55:17 UTC

[jira] [Commented] (DERBY-6408) EXISTS returns NULL instead of FALSE

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

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

Possibly related problem (I think both this query and the EXISTS query in the bug description will be flattened into an EXISTS join, as explained in [http://db.apache.org/derby/docs/10.10/tuning/ctuntransform25868.html]):

{noformat}
ij> values 1 in (select 2 from sysibm.sysdummy1);
1    
-----
NULL 

1 row selected
{noformat}

It should have returned FALSE, not NULL.

> EXISTS returns NULL instead of FALSE
> ------------------------------------
>
>                 Key: DERBY-6408
>                 URL: https://issues.apache.org/jira/browse/DERBY-6408
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.10.1.1
>            Reporter: Knut Anders Hatlen
>
> The reference manual topic on Boolean expressions - http://db.apache.org/derby/docs/10.10/ref/rrefsqlj23075.html - says that EXISTS should return FALSE if the subquery returns no rows. In reality, it returns NULL:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> values exists(select * from t);
> 1    
> -----
> NULL 
> 1 row selected
> SQL:2011, part 2, 8.10 <exists predicate> also says that FALSE is the correct result if the cardinality is 0.



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