Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6FD3699CD for ; Sun, 19 Feb 2012 19:23:05 +0000 (UTC) Received: (qmail 39397 invoked by uid 500); 19 Feb 2012 19:23:05 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 39374 invoked by uid 500); 19 Feb 2012 19:23: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 39364 invoked by uid 99); 19 Feb 2012 19:23:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Feb 2012 19:23:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Feb 2012 19:23:04 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E9C261C07B1 for ; Sun, 19 Feb 2012 19:22:42 +0000 (UTC) Date: Sun, 19 Feb 2012 19:22:42 +0000 (UTC) From: "Mike Matrigali (Commented) (JIRA)" To: derby-dev@db.apache.org Message-ID: <1080463477.780.1329679363320.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <705673341.66753.1327326281415.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DERBY-5584) Select statement with subqueries with group by and count distinct statements returns wrong number of results MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-5584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13211493#comment-13211493 ] Mike Matrigali commented on DERBY-5584: --------------------------------------- I ran full set of tests with the patch and it passed on windows, xp, ibm16 with no errors. > Select statement with subqueries with group by and count distinct statements returns wrong number of results > ------------------------------------------------------------------------------------------------------------ > > Key: DERBY-5584 > URL: https://issues.apache.org/jira/browse/DERBY-5584 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.7.1.1 > Environment: Output from sysinfo > java.specification.name: Java Platform API Specification > java.specification.version: 1.6 > java.runtime.version: 1.6.0_20-b02 > --------- Derby Information -------- > JRE - JDBC: Java SE 6 - JDBC 4.0 > [/home/piotrz/Desktop/db-derby-10.7.1.1-bin/lib/derby.jar] 10.7.1.1 - (1040133) > [/home/piotrz/Desktop/db-derby-10.7.1.1-bin/lib/derbytools.jar] 10.7.1.1 - (1040133) > [/home/piotrz/Desktop/db-derby-10.7.1.1-bin/lib/derbynet.jar] 10.7.1.1 - (1040133) > [/home/piotrz/Desktop/db-derby-10.7.1.1-bin/lib/derbyclient.jar] 10.7.1.1 - (1040133) > ------------------------------------------------------ > ----------------- Locale Information ----------------- > Current Locale : [English/United States [en_US]] > Found support for locale: [cs] > version: 10.7.1.1 - (1040133) > Found support for locale: [de_DE] > version: 10.7.1.1 - (1040133) > Found support for locale: [es] > version: 10.7.1.1 - (1040133) > Found support for locale: [fr] > version: 10.7.1.1 - (1040133) > Found support for locale: [hu] > version: 10.7.1.1 - (1040133) > Found support for locale: [it] > version: 10.7.1.1 - (1040133) > Found support for locale: [ja_JP] > version: 10.7.1.1 - (1040133) > Found support for locale: [ko_KR] > version: 10.7.1.1 - (1040133) > Found support for locale: [pl] > version: 10.7.1.1 - (1040133) > Found support for locale: [pt_BR] > version: 10.7.1.1 - (1040133) > Found support for locale: [ru] > version: 10.7.1.1 - (1040133) > Found support for locale: [zh_CN] > version: 10.7.1.1 - (1040133) > Found support for locale: [zh_TW] > version: 10.7.1.1 - (1040133) > Reporter: Piotr Zgadzaj > Assignee: Bryan Pendleton > Labels: derby_triage10_9 > Attachments: patch1.txt, query.log, tests.out, tests.sql, try1.txt > > > Steps to reproduce: > 1. Create database, connect to database with any JDBC client > 2. create two tables: > CREATE TABLE TEST_5 ( > profile_id INTEGER NOT NULL, > group_ref INTEGER NOT NULL, > matched_count INTEGER NOT NULL > ); > CREATE TABLE TEST_6 ( > profile_id INTEGER NOT NULL, > group_ref INTEGER NOT NULL, > matched_count INTEGER NOT NULL > ); > 3. Insert two records for each table: > insert into test_5 values (1, 10000,1); > insert into test_5 values (2, 10000, 2); > insert into test_6 values (1, 10000,1); > insert into test_6 values (2, 10000, 2); > 4. Run following statement > SELECT * > FROM > (SELECT ps1.group_ref, > COUNT(DISTINCT ps1.matched_count) AS matched_count > FROM test_5 ps1 > GROUP BY ps1.group_ref, > ps1.profile_id > ) a, > (SELECT ps2.group_ref, > COUNT( DISTINCT ps2.matched_count) AS matched_count > FROM test_6 ps2 > GROUP BY ps2.group_ref, > ps2.profile_id > ) b > As a result I've got 3 records instead of 4 - at least Oracle 10g > returns 4 records for this statement. Maybe i'm doing something wrong. > Do you have any suggestions / possible workarounds for this problem -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira