db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4371) Non-selected columns for SELECT DISTINCT allowed in ORDER BY clause if ordered by expression
Date Mon, 26 Apr 2010 14:07:32 GMT

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

Bryan Pendleton commented on DERBY-4371:
----------------------------------------

Hi Nirmal, thanks for the patch, it looks very promising.
Here's a couple things that occurred to me as I read it:

1) Is the instanceof check for BinaryOperatorNode necessary?
What would happen if it was removed?

2) Did you run the JUnit test suites? Or just the derbyall suite?

3) Can you add some new JUnit test cases to cover some of
the variations that are handled by the new code? In particular,
it would be nice to have test cases for the ORDER BY statements that
are mentioned in the bug description, and it would be nice to have
test cases for the ORDER BY statements that you mention in
your comments in the patch.

I think that DistinctTest.java would be a fine place to add the test cases.

4) Something about this loop looks strange:

    for (int i=1; i<target.getResultColumns().size() ;i++ ){

Usually, either the loop counter starts at 0, or the loop test
is for <=, not <. Do you think the start and end conditions are
correct in this case?


> Non-selected columns for SELECT DISTINCT allowed in ORDER BY clause if ordered by expression
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4371
>                 URL: https://issues.apache.org/jira/browse/DERBY-4371
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1
>            Reporter: Bernt M. Johnsen
>            Assignee: C.S. Nirmal J. Fernando
>            Priority: Critical
>         Attachments: DERBY-4371.diff
>
>
> How to repeat:
> ij> create table t (i integer, j integer);;
> 0 rows inserted/updated/deleted
> ij> insert into t values (1,2),(1,3);
> 2 rows inserted/updated/deleted
> ij> select distinct i from t order by j;
> ERROR 42879: The ORDER BY clause may not contain column 'J', since the query specifies
DISTINCT and that column does not appear in the query result.
> ij> select distinct i from t order by j*2;
> I          
> -----------
> 1          
> 1          
> 2 rows selected

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