Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 97196 invoked from network); 2 Dec 2004 16:56:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Dec 2004 16:56:41 -0000 Received: (qmail 54916 invoked by uid 500); 2 Dec 2004 16:56:35 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 54887 invoked by uid 500); 2 Dec 2004 16:56:35 -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 54869 invoked by uid 99); 2 Dec 2004 16:56:34 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from pimout3-ext.prodigy.net (HELO pimout3-ext.prodigy.net) (207.115.63.102) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 02 Dec 2004 08:56:32 -0800 Received: from [67.120.209.58] (adsl-67-120-209-58.dsl.sntc01.pacbell.net [67.120.209.58]) by pimout3-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id iB2GuImt373178 for ; Thu, 2 Dec 2004 11:56:27 -0500 Message-ID: <41AF49C9.8090705@Mutagen.Net> Date: Thu, 02 Dec 2004 08:58:49 -0800 From: Jack Klebanoff User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list References: <1282959885.1101983902639.JavaMail.apache@nagoya> In-Reply-To: <1282959885.1101983902639.JavaMail.apache@nagoya> X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Jan Hlavat? (JIRA) wrote: > [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56090 ] > >Jan Hlavat� commented on DERBY-13: >---------------------------------- > >I think you need to store table name as a pair , not as a single String. >As delimited identifiers can contain arbitrary characters, you dont have a reliable delimiter character to separate, and any escaping mechanism would be costly. > > > >>Quoted names with embedded period mishandled in from list >>--------------------------------------------------------- >> >> Key: DERBY-13 >> URL: http://nagoya.apache.org/jira/browse/DERBY-13 >> Project: Derby >> Type: Bug >> Components: SQL >> Versions: 10.0.2.0 >> Reporter: Ramandeep Kaur >> Priority: Minor >> Attachments: Derby-13.patch >> >>Opening this bug on behalf of Satheesh Bandaram >>--------------------------------------------------------- >>The compiler mishandles quoted names with embedded periods when >>checking uniqueness of table names in the from list of a >>SELECT. Consider the following SQL: >> create table "S1.T1" (id int not null primary key, d1 int); >> create schema s1; >> create table s1.t1 (id int not null primary key, d2 int); >> select * from s1.t1, "S1.T1" where s1.t1.id = "S1.T1".id; >>Derby throws an error on the final SELECT statement: >>"ERROR 42X09: The table or alias name 'S1.T1' is used more than >>once in the FROM list". However s1.t1 and "S1.T1" are different >>tables. >> >> > > > I agree with Jan. Representing table names as a (schema, table) pair is more straightforward, if we are to handle the corner cases correctly. It captures the fact that a table name is not a simple string and that a simple string comparison does not always correctly compute name equivalence. Another consideration is the equivalence of delimited and non-delimited identifiers. For instance the undelimited identifier id, and the delimited identifier "ID" are supposed to be identical. The SQL standard says "A and a are equivalent if the of the (with every letter that is a lower-case letter replaced by the corresponding upper-case letter or letters) and the of the (with all occurrences of replaced by and all occurrences of replaced by ), considered as the repetition of a that specifies a of SQL_IDENTIFIER and an implementationdefined collation that is sensitive to case, compare equally according to the comparison rules in Subclause 8.2, ����". (That is one long sentence). If we store delimited identifiers with double quotes and undelimited identifiers without then a simple string comparison will miss this equivalence. I think that it is important that we get this equivalence right. Some DML is generated programmatically from metadata and always uses delimited identifiers, even if the DDL did not. Changing Derby to use a (schema, table) pair instead of a simple string for table names is a lot of work. A large number of files must be changed. Jack