Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 85243 invoked from network); 15 Aug 2007 19:17:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Aug 2007 19:17:52 -0000 Received: (qmail 94460 invoked by uid 500); 15 Aug 2007 19:17:49 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 94433 invoked by uid 500); 15 Aug 2007 19:17:49 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 94424 invoked by uid 99); 15 Aug 2007 19:17:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2007 12:17:49 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2007 19:17:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E3C0C7141E2 for ; Wed, 15 Aug 2007 12:17:30 -0700 (PDT) Message-ID: <18961397.1187205450915.JavaMail.jira@brutus> Date: Wed, 15 Aug 2007 12:17:30 -0700 (PDT) From: "Daniel Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-312) derby fails with duplicate primary key(s) in group by list In-Reply-To: <8026787.1186710222542.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/OPENJPA-312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Lee updated OPENJPA-312: ------------------------------- Attachment: OPENJPA-312.patch > derby fails with duplicate primary key(s) in group by list > ---------------------------------------------------------- > > Key: OPENJPA-312 > URL: https://issues.apache.org/jira/browse/OPENJPA-312 > Project: OpenJPA > Issue Type: Bug > Components: sql > Affects Versions: 1.0.0 > Reporter: Daniel Lee > Assignee: Daniel Lee > Priority: Minor > Fix For: 1.0.0 > > Attachments: OPENJPA-312.patch, OPENJPA-312.patch, OPENJPA-312.patch > > > derby fails with duplicate primary key(s) in group by list > With query "select o.customer, avg(o.amount) from Order o group by o.customer" the push-down query contains duplicate columns in the group by clause. This is okay when DB2 and other DB that tolerate the duplicates but Derby returns error. > Of course, we can ask fix on Derby but we can also easy fix in OpenJPA to avoid duplicates in the group by list. Please refer to the following for the error result and the attach patch for the fix. > Output from running the query that generate duplicate in the group by list: > 6429 demo TRACE [main] openjpa.Query - Executing query: select o.customer, avg(o.amount) from Order o group by o.customer > 6639 demo TRACE [main] openjpa.jdbc.SQL - executing prepstmnt 1405375428 SELECT t1.countryCode, t1.id, t1.version, t1.city, t1.state, t1.street, t1.zip, t1.creditRating, t1.name, AVG(t0.amount) FROM Order t0 INNER JOIN Customer t1 ON t0.customer_countryCode = t1.countryCode AND t0.customer_id = t1.id GROUP BY t1.countryCode, t1.id, t1.version, t1.countryCode, t1.id, t1.city, t1.state, t1.street, t1.zip, t1.countryCode, t1.id, t1.creditRating, t1.name -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.