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-4380) SOME not allowed in ON clause
Date Sat, 14 Nov 2009 01:37:39 GMT

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

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

Then NPE can be triggered with an even simpler query:

create table t(x int);
insert into t values 1;
select 1 from t t1 join t t2 on t1.x in
    (select 1 from t a left join t b on 1=0 where b.x=1);

When I look at the query tree after optimization, it looks as if the result column list for
the HalfOuterJoinNode contains a ResultColumn/VirtualColumnNode chain that ends up in a BaseColumn
for B.X, which sounds reasonable since B.X is needed for the restriction B.X=1. However, the
HalfOuterJoinNode's right child, from which that base column should be retrieved, has a separate
chain that ends up in a different BaseColumn for B.X. I believe that in a correct tree, the
column chain in the HalfOuterJoinNode should be connected to the chain of its right child,
and there should be only one BaseColumn for B.X in the tree.

> SOME not allowed in ON clause
> -----------------------------
>
>                 Key: DERBY-4380
>                 URL: https://issues.apache.org/jira/browse/DERBY-4380
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Bernt M. Johnsen
>         Attachments: on_subquery.diff
>
>
> SOME is not allowed in ON-clause:
> ij> create table t1 (i integer);
> 0 rows inserted/updated/deleted
> ij> create table t2 (i integer);
> 0 rows inserted/updated/deleted
> ij> create table t3 (i integer);
> 0 rows inserted/updated/deleted
> ij> insert into t1 values (1);
> 1 row inserted/updated/deleted
> ij> insert into t2 values (2);
> 1 row inserted/updated/deleted
> ij> insert into t3 values 2,3,4;
> 3 rows inserted/updated/deleted
> ij> select * from t1 where t1.i = some (select i from t3);
> I          
> -----------
> 0 rows selected
> ij> select * from t1 inner join t2 on  t1.i = some (select i from t3);
> ERROR 42972: An ON clause associated with a JOIN operator is not valid.
> ij> 

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