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 08BC8998B for ; Thu, 2 Feb 2012 15:46:16 +0000 (UTC) Received: (qmail 47938 invoked by uid 500); 2 Feb 2012 15:46:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 47877 invoked by uid 500); 2 Feb 2012 15:46:15 -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 47867 invoked by uid 99); 2 Feb 2012 15:46:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2012 15:46:14 +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; Thu, 02 Feb 2012 15:46:13 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 85D87188483 for ; Thu, 2 Feb 2012 15:45:53 +0000 (UTC) Date: Thu, 2 Feb 2012 15:45:53 +0000 (UTC) From: "Mamta A. Satoor (Commented) (JIRA)" To: derby-dev@db.apache.org Message-ID: <1650333266.3065.1328197553549.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 [ https://issues.apache.org/jira/browse/DERBY-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198885#comment-13198885 ] Mamta A. Satoor commented on DERBY-4631: ---------------------------------------- I cam across atleast following 2 queries that both fail with NPE and I am looking into those, create table t1(a int, b int, c int); create table t2(b int, c int, d int); create table t3(d int, e varchar(5), f int); insert into t1 values (1,2,3),(2,3,4),(4,4,4); insert into t2 values (1,2,3),(2,3,4),(5,5,5); insert into t3 values (2,'abc',3),(4,'def',5),(null,null,null); select c from t1 right join t2 using (c) order by t1.c; select c,a+1 from t1 right join t2 using (c); The order by query is failing in generated code whereas the query with "a+1" is failing during bind time. > 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 > > > 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