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] Issue Comment Edited: (DERBY-4371) Non-selected columns for SELECT DISTINCT allowed in ORDER BY clause if ordered by expression
Date Mon, 03 May 2010 13:38:55 GMT

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

Knut Anders Hatlen edited comment on DERBY-4371 at 5/3/10 9:37 AM:
-------------------------------------------------------------------

Hi Nirmal,

Sorry for not being clear. I didn't mean to suggest two different approaches, but one approach
with two steps. If we only implement step 2, we won't allow statements like this one (which
are allowed according to the standard):

SELECT DISTINCT C1+1 FROM T ORDER BY C1+1

      was (Author: knutanders):
    Hi Nirmal,

Sorry for not being clear. I didn't mean to suggest two different approaches, but one approach
with two steps. If we only implement step 2, we won't allow statements like this one (which
are allowed according to the standard):

SELECT DISTINCT C1+1 ORDER BY C1+1
  
> 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-2.diff, DERBY-4371-3.diff, DERBY-4371-4.diff, 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