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

Knut Anders Hatlen updated DERBY-6577:
--------------------------------------

    Attachment: d6577-2a.diff

Attaching [^d6577-2a.diff] which changes the three occurrences I found, where 
the return value of ValueNode.preprocess() is discarded instead of being used 
to update the preprocessed field.

I don't think this fixes any bugs currently. In SelectNode.whereClause and 
JoinNode.joinClause have been normalized before preprocess() is called, so they 
are always AndNodes. Since AndNode.preprocess() currently always returns 
itself, updating the fields to the returned values won't actually change them.

Similarly, for SQLToJavaValueNode.value, it seems to be a CastNode in my 
experiments (don't know if it always is, though). And CastNode.preprocess() 
also always returns itself, so it doesn't make any difference whether or not 
the field is updated.

I still think the fields should be updated for completeness, and to prevent 
bugs if the logic ever changes so that preprocess() in these cases could return 
a different node than the node it is called on.

All regression tests ran cleanly with the patch.

> Quantified comparison returns wrong result in CASE, COALESCE, IN and BETWEEN
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-6577
>                 URL: https://issues.apache.org/jira/browse/DERBY-6577
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.11.0.0, 10.10.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d6577-1a.diff, d6577-2a.diff
>
>
> I'm seeing this on head of trunk:
> {noformat}
> ij> select c, c = all (values 'Y'), case when c = all (values 'Y') then true 
> else false end from (values 'Y', 'N') v(c);
> C|2    |3    
> -------------
> Y|true |false
> N|false|true 
> 2 rows selected
> {noformat}
> Column 2 and column 3 should have the same value, but something seems to go 
> wrong when the quantified comparison is used in a CASE expression.
> I'm seeing the expected result on 10.10.2.0, though:
> {noformat}
> ij> select c, c = all (values 'Y'), case when c = all (values 'Y') then true 
> else false end from (values 'Y', 'N') v(c);
> C|2    |3    
> -------------
> Y|true |true 
> N|false|false
> 2 rows selected
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to