You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Satheesh Bandaram (JIRA)" <de...@db.apache.org> on 2005/12/02 03:23:35 UTC

[jira] Commented: (DERBY-280) Wrong result from select when aliasing to same name as used in group by

    [ http://issues.apache.org/jira/browse/DERBY-280?page=comments#action_12359116 ] 

Satheesh Bandaram commented on DERBY-280:
-----------------------------------------

Thanks Kathey... Your comment explains what you were refering to. There was a potential regression that was found and fixed during the review/commit process, so I thought you were refering to that.

About the SQL: select a+1 as a, a+1 as a from bug280 group by a, the patch does prevent its use now. But the statement is so (likely) rare and with the patch it gives a nice error message on what to change, I think it might be sufficient. Also Rick only marked this incomplete, keeping it open for improvement, I think. If you still have an itch to file a bug, go ahead!


> Wrong result from select when aliasing to same name as used in group by
> -----------------------------------------------------------------------
>
>          Key: DERBY-280
>          URL: http://issues.apache.org/jira/browse/DERBY-280
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Bernt M. Johnsen
>     Assignee: Rick Hillegas
>     Priority: Minor
>  Attachments: bug280.diff
>
> Wrong result from select when aliasing to same name as used in group by. Example:
> If we have the following table:
>     ij> select * from tt;
>     I          |J
>     -----------------------
>     1          |2
>     2          |3
>     1          |2
>     2          |3
>     2          |3
>                                                                                                                                              
>     5 rows selected
> The following select is ok:
>     ij> select i, count(*) as cnt from tt group by i;
>     I          |CNT
>     -----------------------
>     1          |2
>     2          |3
>                                                                                                                                              
>     2 rows selected
> But this one returns wrong result in the aliased column:
>     ij> select i, count(*) as i from tt group by i;
>     I          |I
>     -----------------------
>     1          |1
>     2          |2
>                                                                                                                                              
>     2 rows selected
>                                                                                                                                              

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira