Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 48626 invoked from network); 17 Nov 2005 19:00:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Nov 2005 19:00:06 -0000 Received: (qmail 71519 invoked by uid 500); 17 Nov 2005 19:00:05 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 71491 invoked by uid 500); 17 Nov 2005 19:00:05 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 71482 invoked by uid 99); 17 Nov 2005 19:00:05 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2005 11:00:03 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 836DF21C for ; Thu, 17 Nov 2005 19:59:42 +0100 (CET) Message-ID: <243216057.1132253982535.JavaMail.jira@ajax.apache.org> Date: Thu, 17 Nov 2005 19:59:42 +0100 (CET) From: "Satheesh Bandaram (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-280) Wrong result from select when aliasing to same name as used in group by In-Reply-To: <635945000.1115971694156.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-280?page=comments#action_12357918 ] Satheesh Bandaram commented on DERBY-280: ----------------------------------------- I have submitted this fix to trunk. Please Resolve and Close the bug after confirming the fix. I have added a comment to indicate this problem is caused by current parser rewrite and that any fix to address Derby-681 would make this problem go away. Rick, I hope you don't mind this comment: ** This issue is caused by parser rewriting of group by/having clauses ** into table expressions. (See function tableExpression() in this file) ** There is an improvement request filed under DERBY-681 to eliminate this ** rewrite, after which it should be possible to allow multiple columns to ** have same name in the select list. Sending java\engine\org\apache\derby\iapi\reference\SQLState.java Sending java\engine\org\apache\derby\impl\sql\compile\sqlgrammar.jj Sending java\engine\org\apache\derby\loc\messages_en.properties Sending java\testing\org\apache\derbyTesting\functionTests\master\aggregate.out Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\aggregate.sql Transmitting file data ..... Committed revision 345304. > 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