Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 63348 invoked from network); 11 Jan 2005 07:48:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Jan 2005 07:48:51 -0000 Received: (qmail 39538 invoked by uid 500); 11 Jan 2005 07:48:50 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 39494 invoked by uid 500); 11 Jan 2005 07:48:50 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 39480 invoked by uid 99); 11 Jan 2005 07:48:50 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from smtp818.mail.sc5.yahoo.com (HELO smtp818.mail.sc5.yahoo.com) (66.163.170.4) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 10 Jan 2005 23:48:49 -0800 Received: from unknown (HELO debrunners.com) (ddebrunner@sbcglobal.net@64.161.25.119 with plain) by smtp818.mail.sc5.yahoo.com with SMTP; 11 Jan 2005 07:48:47 -0000 Message-ID: <41E384C1.4090102@debrunners.com> Date: Mon, 10 Jan 2005 23:48:17 -0800 From: Daniel John Debrunner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4.1) Gecko/20031008 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: (DERBY-13) Quoted names with embedded period mishandled in from References: <41DAF72E.4050009@debrunners.com> <41DB74B8.6040808@Sun.COM> <41DC4ED2.1080408@debrunners.com> <41DD07F1.1050106@Sun.COM> <41E26E58.9050502@Sun.COM> <41E295FF.20904@debrunners.com> <41E3540B.4060803@Sun.COM> In-Reply-To: <41E3540B.4060803@Sun.COM> X-Enigmail-Version: 0.76.8.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Shreyas Kaushik wrote: > Yes it does. > > Daniel John Debrunner wrote: > >> >>Does the fix correctly implement duplicate name checking as detailed in >>this mail? >> >>http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=derby-dev@db.apache.org&msgNo=1569 Hmmm, I don't see how the change in FromList (extracted below) will correctly handle select ... FROM A.T1 as C, B.T2 as C It seems that the leftTable variable will be set to and rightTable set to which will not compare as equal. Am I missing something? If the patch had tests I could see if this case was handled. The code in FromList is not that clear to me, could be helped by comments, and it concerns me that a TableName object is created out of a schema name and a correlation name when such a construct has no valid meaning. I see that you are hampered by the fact that there is no way to tell if a correlation name has been used. In msgNo 1569 I laid out that it would be best if there were two getExposed methods, but now I think a single String getExposedName() will do, as long as it returns null if no correlation name was used. That might have a ripple effect though the code, but the best way to fix a bug is sometimes a minor rework, rather than just band-aids on existing bad code. I think the fact that exposed name handling has three bugs shows a re-work is needed. In any re-work I would start out with explicitly stating how exposed names are handled for a table in the from list and for a column reference, and then how the two uses relate and compare. Other comments on the patch are: - - for the code extract below as a minor nit I would avoid using terms like 'leftTable' or 'rightTable' unless left and right actual have meaning, which they don't here. One table in a list is being compared against the others in the list. - - The other set of changes related to getAllResultColumns() again have the possible issue of creating a TableName out of a schema name and correlation name. I assume these are to fix derby-12, again comments would be useful. Also any comments you have on if this fixes Derby-18 and Derby-12 would be helpful. Dan. - - if (fromTable.getExposedName().equals - - (((FromTable) elementAt(index)).getExposedName()) ) + leftTable = makeTableName( fromTable.getTableName().getSchemaName(), + fromTable.getExposedName()); + + if(((FromTable) elementAt(index)).getTableName() == null) { + rightTable = makeTableName(null, ((FromTable) elementAt(index)).getExposedName()); + } + + else { + rightTable = makeTableName(((FromTable) elementAt(index)).getTableName().getSchemaName(), + ((FromTable) elementAt(index)).getExposedName()); + } + if(leftTable.equals(rightTable)) { throw StandardException.newException(SQLState.LANG_FROM_LIST_DUPLICATE_TABLE_NAME, fromTable.getExposedName()); } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFB44TBIv0S4qsbfuQRAjgCAKC7xhogSSJgQS3YeGVLxiM3ePdBmgCgqGd2 jRQZ5MXv5Z6nti9/r5iwQDo= =FFKt -----END PGP SIGNATURE-----