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 432B19565 for ; Tue, 21 Feb 2012 01:21:59 +0000 (UTC) Received: (qmail 39642 invoked by uid 500); 21 Feb 2012 01:21:59 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 39619 invoked by uid 500); 21 Feb 2012 01:21:59 -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 39612 invoked by uid 99); 21 Feb 2012 01:21:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Feb 2012 01:21:59 +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; Tue, 21 Feb 2012 01:21:56 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E2CF92B2A7A for ; Tue, 21 Feb 2012 01:21:34 +0000 (UTC) Date: Tue, 21 Feb 2012 01:21:34 +0000 (UTC) From: "Mamta A. Satoor (Commented) (JIRA)" To: derby-dev@db.apache.org Message-ID: <1734104896.4267.1329787294930.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DERBY-4631) Wrong join column returned by right outer join with NATURAL or USING and territory-based collation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13212276#comment-13212276 ] Mamta A. Satoor commented on DERBY-4631: ---------------------------------------- I have been working on writing more tests for JOINs to see nothing breaks with my changes. Unfortunately, the following script with the patch DERBY_4631_patch3_diff.txt patch gives ERROR 38000: The exception 'java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -2' was thrown while evaluating an expression. connect 'jdbc:derby:db1;create=true;territory=en_US;collation=TERRITORY_BASED:SECONDARY'; CREATE TABLE derby4631_t1(x varchar(5)); INSERT INTO derby4631_t1 VALUES 'A','B'; CREATE TABLE derby4631_t2(x varchar(5)); INSERT INTO derby4631_t2 VALUES 'b','c'; CREATE TABLE derby4631_t3(x1 varchar(5), y1 varchar(5)); INSERT INTO derby4631_t3 SELECT x, 'a' FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1; I am debugging the patch to see what is causing the failure. > Wrong join column returned by right outer join with NATURAL or USING and territory-based collation > -------------------------------------------------------------------------------------------------- > > Key: DERBY-4631 > URL: https://issues.apache.org/jira/browse/DERBY-4631 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.6.1.0 > Reporter: Knut Anders Hatlen > Assignee: Mamta A. Satoor > Labels: derby_triage10_8 > Attachments: DERBY_4631_not_for_commit_patch1_diff.txt, DERBY_4631_not_for_commit_patch1_stat.txt, DERBY_4631_not_for_commit_patch2_diff.txt, DERBY_4631_not_for_commit_patch2_stat.txt, DERBY_4631_patch3_diff.txt, DERBY_4631_patch3_stat.txt > > > SQL:2003 says that the join columns in a natural join or in a named > columns join should be added to the select list by coalescing the > column from the left table with the column from the right table. > Section 7.7, , syntax rules: > > 1) Let TR1 be the first , and let TR2 be the
> reference> or
that is the second operand of the > > . Let RT1 and RT2 be the row types of TR1 and TR2, > > respectively. Let TA and TB be the range variables of TR1 and TR2, > > respectively. (...) > and > > 7) If NATURAL is specified or if a immediately > > containing a is specified, then: > (...) > > d) If there is at least one corresponding join column, then let SLCC > > be a