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

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

SubqueryNode apparently rewrites queries with ALL differently depending on 
whether the columns are nullable or not. Since we only see this problem when 
the column isn't nullable, that's probably a good starting point for tracking 
down the bug. Here's a comment from SubqueryNode.pushNewPredicate():

                /* For NOT IN or ALL, and if either side of the comparison is 
nullable, and the
                 * subquery can not be flattened (because of that), we need to 
add IS NULL node
                 * on top of the nullables, such that the behavior is (beetle 
5173):
                 *
                 *    (1) If we have nulls in right operand, no row is returned.
                 *    (2) If subquery result is empty before applying join 
predicate, every
                 *                left row (including NULLs) is returned.
                 *        (3) Otherwise, return {all left row} - {NULLs}
                 */

> Sequence comparison with "ALL" does not yield correct results
> -------------------------------------------------------------
>
>                 Key: DERBY-4001
>                 URL: https://issues.apache.org/jira/browse/DERBY-4001
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.2.1
>         Environment: Windows
>            Reporter: Venkateswaran Iyer
>            Priority: Minor
>             Fix For: 10.4.2.0
>
>
> A query involving "< ALL" does not yield the right results for decimal 
> datatype. "< ANY" works, though.
> To reproduce the issue:
> % create table t1(col1 decimal(10,5));
> % insert into t1 values (-21483.64800);
> % insert into t1 values (74837.00000);
> % select col1 from t1 where col1 < ALL (select 0.0 from t1);
> The above yields no results whereas it should return the first row.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to