Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 16486 invoked from network); 2 Mar 2008 22:44:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Mar 2008 22:44:58 -0000 Received: (qmail 80710 invoked by uid 500); 2 Mar 2008 22:44:53 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80674 invoked by uid 500); 2 Mar 2008 22:44:53 -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 80665 invoked by uid 99); 2 Mar 2008 22:44:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Mar 2008 14:44:53 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Mar 2008 22:44:14 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 66837234C083 for ; Sun, 2 Mar 2008 14:43:50 -0800 (PST) Message-ID: <326466935.1204497830418.JavaMail.jira@brutus> Date: Sun, 2 Mar 2008 14:43:50 -0800 (PST) From: "Bryan Pendleton (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-2351) ORDER BY with expression with distinct in the select list returns incorrect result In-Reply-To: <5230524.1171672685493.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bryan Pendleton updated DERBY-2351: ----------------------------------- Attachment: d2351_aliasing.diff Matching first on the exposedName, then on the underlying name, seems like a promising technique for this issue. Attached is d2351_aliasing.diff, a patch proposal with a code change as described in the previous comment and some additional tests. This patch passes the existing regression tests. Comments are most welcome. > ORDER BY with expression with distinct in the select list returns incorrect result > ---------------------------------------------------------------------------------- > > Key: DERBY-2351 > URL: https://issues.apache.org/jira/browse/DERBY-2351 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6, 10.2.2.0, 10.3.1.4 > Environment: Any > Reporter: Yip Ng > Assignee: Bryan Pendleton > Fix For: 10.3.2.2, 10.4.0.0 > > Attachments: d2351_aliasing.diff, derby_2351.diff, derby_2351_v2.diff, reproTests.diff > > > When distinct is in the select list and the query has order by with expression, the resultset produced contains an additional column. > ij> create table t1 (c1 int, c2 varchar(10)) > 0 rows inserted/updated/deleted > ij> insert into t1 values (1,'a'),(2,'b'),(3,'c'); > 3 rows inserted/updated/deleted > select distinct c1, c2 from t1 order by c1; > C1 |C2 > ---------------------- > 1 |a > 2 |b > 3 |c > 3 rows selected > ij> select distinct c1, c2 from t1 order by c1+1; > C1 |C2 |3 <=====returns 3 columns, incorrect result returned > ---------------------------------- > 1 |a |2 > 2 |b |3 > 3 |c |4 > 3 rows selected -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.