You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by de...@db.apache.org on 2004/09/29 20:52:32 UTC

[jira] Created: (DERBY-13) Quoted names with embedded period mishandled in from list

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/DERBY-13

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DERBY-13
    Summary: Quoted names with embedded period mishandled in from list
       Type: Bug

     Status: Unassigned
   Priority: Minor

    Project: Derby
 Components: 
             SQL
   Versions:
             10.0.2.0

   Assignee: 
   Reporter: Ramandeep Kaur

    Created: Wed, 29 Sep 2004 11:51 AM
    Updated: Wed, 29 Sep 2004 11:51 AM

Description:
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.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Amit Handa (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_57109 ]
     
Amit Handa commented on DERBY-13:
---------------------------------

I think we need to understand that we are using String for TableName and not as an object of type TableName.java. Hence associating a schema with a table name which would otherwise have been possible(TableName.setSchemaName) cannot happen, is a problem.

Secondly irrespective of whether a user gives a schema name (prefixes or not) we need to store the schema name(after clearly identifying the schema name), for every table name and cannot assume it to be NULL, else we get in problems like this.

So 

1. either change from String tableName to TableName tableName.

2. build a tableName object(of type TableName object) from the String and try to get handle to schema name (using the select query String as well).

Note : the basic objective of either approach is to get handle to a schema name as and when it is required.

1. is complex and may involve lot of changes wheras 2. is fairly simple.
If we can achive using 2 that will be better.









> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Assigned: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
U are correct... I think both of them seem to have been fixed, based on
the test case in the defect. I will close both of them, if everyone agrees.

Satheesh

Shreyas Kaushik wrote:

> I thought this was patched ??
>
> ~ Shreyas
>
> Jack Klebanoff (JIRA) wrote:
>
>>     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]
>>
>> Jack Klebanoff reassigned DERBY-13:
>> -----------------------------------
>>
>>    Assign To: Jack Klebanoff
>>
>>  
>>
>>> Quoted names with embedded period mishandled in from list
>>> ---------------------------------------------------------
>>>
>>>         Key: DERBY-13
>>>         URL: http://issues.apache.org/jira/browse/DERBY-13
>>>     Project: Derby
>>>        Type: Bug
>>>  Components: SQL
>>>    Versions: 10.0.2.0
>>>    Reporter: Ramandeep Kaur
>>>    Assignee: Jack Klebanoff
>>>    Priority: Minor
>>> Attachments: Derby-13.diff, Derby-13.patch, derbylang_report.txt
>>>
>>> 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.
>>>   
>>
>>
>>  
>>
>
>
>


Re: [jira] Assigned: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Shreyas Kaushik <Sh...@Sun.COM>.
I thought this was patched ??

~ Shreyas

Jack Klebanoff (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]
>
>Jack Klebanoff reassigned DERBY-13:
>-----------------------------------
>
>    Assign To: Jack Klebanoff
>
>  
>
>>Quoted names with embedded period mishandled in from list
>>---------------------------------------------------------
>>
>>         Key: DERBY-13
>>         URL: http://issues.apache.org/jira/browse/DERBY-13
>>     Project: Derby
>>        Type: Bug
>>  Components: SQL
>>    Versions: 10.0.2.0
>>    Reporter: Ramandeep Kaur
>>    Assignee: Jack Klebanoff
>>    Priority: Minor
>> Attachments: Derby-13.diff, Derby-13.patch, derbylang_report.txt
>>
>>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.
>>    
>>
>
>  
>

[jira] Assigned: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jack Klebanoff (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]

Jack Klebanoff reassigned DERBY-13:
-----------------------------------

    Assign To: Jack Klebanoff

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.apache.org/jira/browse/DERBY-13
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: Ramandeep Kaur
>     Assignee: Jack Klebanoff
>     Priority: Minor
>  Attachments: Derby-13.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=history ]

Shreyas Kaushik updated DERBY-13:
---------------------------------

    Attachment: Derby-13.diff

Latest proposed patch for Derby-13

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]

Kathey Marsden updated DERBY-13:
--------------------------------

    Fix Version: 10.1.1.0
      Assign To: Shreyas Kaushik

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.apache.org/jira/browse/DERBY-13
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: Ramandeep Kaur
>     Assignee: Shreyas Kaushik
>     Priority: Minor
>      Fix For: 10.1.1.0
>  Attachments: Derby-13.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_57085 ]
     
Shreyas Kaushik commented on DERBY-13:
--------------------------------------

In response to Sateesh's comment:

Here in this method the allTableName is just a String and we cannot know the schema name for that table. Only for the table in the from list can the schema be known. So it is still a compile / bind time issue.


> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jack Klebanoff (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56061 ]
     
Jack Klebanoff commented on DERBY-13:
-------------------------------------

The SQL standard does allow just about anything inside a <delimited identifier>.  A delimited identifier is a string delimited by double quotes. For instance, the SQL standard allows
  create table "S1.T1" ...
  select * from "S1.T1"


> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by RPost <rp...@pacbell.net>.
I'm having trouble following this thread and know I could benefit by a brief
overview of the architecture of (at least) two things by anyone familiar
with the internals:

1. The database object architecture
2. The compiler architecture

As Dan pointed out DERBY-13 relates to a reported bug in the compiler
architecture whereas Jack's latest comment seems to be more related to the
object architecture itself.

Would someone volunteer to provide a brief overview of these two
architectures?

1. The database object architecture
  A. Schemas
      1) what are they?
      2) how do they relate to the other DB objects (users, tables,
procedures, etc). For example, are they containers that contain  or even
'own' the other objects or are they independent?
      3) how do DERBY schemas correlate to schemas found in Oracle or DB2 or
do they correlate?

  B. Tables
      1) what are they
      2) how do they relate to the other DB objects (particularly schemas).
      3) Must a table be 'contained' in a schema (as is required in DB2 or
Oracle)?
      4) how do DERBY tables correlate to tables found in Oracle or DB2 or
do they correlate?

My examination of the SQL-92 standard, the DERBY code, the DERBY-13 bug, and
tests with both Oracle (7, 8i, 9i, 10g) and DB2 (7 and 8) appears to show:

1. The tablename S1.T1 is a valid tablename (SQL standard, Oracle, DB2,
DERBY)
2. The tablename S1.T1 is stored in the system tables correctly (Oracle,
DB2, DERBY)
3. The tablename S1.T1 must be created, and can exist in one, and only one,
schema (Oracle, DB2)
       a. What is the rule for DERBY?

>From my tests I would conclude:

1. Schema and tablenames appear to be created properly in the DERBY system
tables.

2. The primary DERBY-13 issue is due to the compilers extraction and use of
the schema and tablenames and is not due to the names being improperly
stored in the repository.

3. The Java string manipulations being performed by DERBY on the schema and
table names is subject to error and, particularly in the 'Equals' methods',
incorrect in several places. In the case of the 'Equals' methods this is due
to the manner in which the Java '+' string concatenation operator, which is
implemented using string buffers, replaces 'null' elements with the string
'null'.

 This alone will cause the two 'Equals' methods that compare TableName
objects and use the getFullTablename  method of TableName to compare
differently than the 'Equals' method that performs a Java '+' string
contatenation. The first two methods perform tests for 'null' while the last
method does not.

4. I don't understand why two 'table name's would be considered equal if
only one of the schema names is null but the other has a value. Are they
only equal within the context of the compiler? Or are they considered equal
if stored in the repository that way? (or is it valid to store a table name
in the repository with a null schema?)

In summary, the architecture should seldom need to be changed to fix a 'bug'
as architecture changes introduce the potential to break far more things
than are fixed.

If, as Jack suggests, another method is needed to represent tablenames, a
new thread should be created to discuss it.

I agree with Dan that introducing a new tablename representation is outside
the scope of DERBY-13.

I don't think it is necessary to introduce a new representation since
tablenames are represented properly as strings as far as I can tell.

I always try to assume that an architecture is correct until proven
incorrect and I would expect that an explanation of the architecture of
schemas and tablenames would clear up any confusion that I have about why
they were designed this way.

I would be happy to work one on one (or in a group) with any of the
developers to begin to document the existing architecture and the design
decisions that went into it. This could be by telephone, email or in person
(I am in the San Francisco Bay area and would be happy to meet with folks on
this).



----- Original Message ----- 
From: "Daniel John Debrunner" <dj...@debrunners.com>
To: "Derby Development" <de...@db.apache.org>
Sent: Friday, December 03, 2004 9:17 AM
Subject: Re: [jira] Commented: (DERBY-13) Quoted names with embedded period
mishandled in from list


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jack Klebanoff wrote:
> > Daniel John Debrunner wrote:
> >
> >> Jack Klebanoff wrote:
> >>
> >>
> >> >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.
> >>
> >>
> >> But Derby doesn't use a simple string for a table name, it uses an
> >> object called TableName, which correctly handles the schema, table name
> >> and quoting. Only in this incorrect 'exposed' table name case is a
> >> string used.
> >>
> >> Dan.
> >
> >
> > TableName is a compiler object, and, as an extension of  QueryTreeNode,
> > it is a fairly heavy duty object tied to a connection. Outside of the
> > compiler transient data structures, and perhaps even some places inside
> > them, we need other mechanisms to represent table names.
>
> Ok, so you are talking about something beyond the scope of Derby-13,
> which is a compile time issue. So I'm  not sure what problem you are
> trying to solve as I thought that schema and table names were handled
> correctly through the runtime code, in terms of SchemaDescriptor and
> TableDescriptor objects.
>
> Maybe you have some example where a table name with schema is only
> represented by a String.
>
> Dan.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFBsJ+UIv0S4qsbfuQRApgRAJ9NQKbAlubCQz7fucM2GCl1fntXDQCfdIgy
> yvYoOulYYcSAujBLCjvK45c=
> =KHwm
> -----END PGP SIGNATURE-----
>


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dain Sundstrom wrote:

> I ran into a bug (DERBY-62) when attempting to delete nonexistent table
> from a remote client derby would produce an exception that held on to a
> TableName object.  When I attempt to send the exception back to the
> remote client, I get an exception due to TableName not being
> serializable.  In this case, "a table name with schema is only
> represented by a String" would be nice :)

I have a fix I'm testing for Derby-62, that is totally unrelated to
Derby-13 or any other string versus object discussions. :-)

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBsQORIv0S4qsbfuQRAno3AJ0UGT6USFaWO3O640WRnnlkyEUQrgCguynl
JKvtnnMvXP4689So4MJ70q8=
=TFqe
-----END PGP SIGNATURE-----


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Dain Sundstrom <ds...@gluecode.com>.
On Dec 3, 2004, at 9:17 AM, Daniel John Debrunner wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jack Klebanoff wrote:
>> Daniel John Debrunner wrote:
>>
>> TableName is a compiler object, and, as an extension of  
>> QueryTreeNode,
>> it is a fairly heavy duty object tied to a connection. Outside of the
>> compiler transient data structures, and perhaps even some places 
>> inside
>> them, we need other mechanisms to represent table names.
>
> Ok, so you are talking about something beyond the scope of Derby-13,
> which is a compile time issue. So I'm  not sure what problem you are
> trying to solve as I thought that schema and table names were handled
> correctly through the runtime code, in terms of SchemaDescriptor and
> TableDescriptor objects.
>
> Maybe you have some example where a table name with schema is only
> represented by a String.

I ran into a bug (DERBY-62) when attempting to delete nonexistent table 
from a remote client derby would produce an exception that held on to a 
TableName object.  When I attempt to send the exception back to the 
remote client, I get an exception due to TableName not being 
serializable.  In this case, "a table name with schema is only 
represented by a String" would be nice :)

-dain


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jack Klebanoff wrote:
> Daniel John Debrunner wrote:
>
>> Jack Klebanoff wrote:
>>
>>
>> >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.
>>
>>
>> But Derby doesn't use a simple string for a table name, it uses an
>> object called TableName, which correctly handles the schema, table name
>> and quoting. Only in this incorrect 'exposed' table name case is a
>> string used.
>>
>> Dan.
>
>
> TableName is a compiler object, and, as an extension of  QueryTreeNode,
> it is a fairly heavy duty object tied to a connection. Outside of the
> compiler transient data structures, and perhaps even some places inside
> them, we need other mechanisms to represent table names.

Ok, so you are talking about something beyond the scope of Derby-13,
which is a compile time issue. So I'm  not sure what problem you are
trying to solve as I thought that schema and table names were handled
correctly through the runtime code, in terms of SchemaDescriptor and
TableDescriptor objects.

Maybe you have some example where a table name with schema is only
represented by a String.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBsJ+UIv0S4qsbfuQRApgRAJ9NQKbAlubCQz7fucM2GCl1fntXDQCfdIgy
yvYoOulYYcSAujBLCjvK45c=
=KHwm
-----END PGP SIGNATURE-----


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Jack Klebanoff <kl...@Mutagen.Net>.
Daniel John Debrunner wrote:

> Jack Klebanoff wrote:
>
>
> >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.
>
>
> But Derby doesn't use a simple string for a table name, it uses an
> object called TableName, which correctly handles the schema, table name
> and quoting. Only in this incorrect 'exposed' table name case is a
> string used.
>
> Dan.

TableName is a compiler object, and, as an extension of  QueryTreeNode, 
it is a fairly heavy duty object tied to a connection. Outside of the 
compiler transient data structures, and perhaps even some places inside 
them, we need other mechanisms to represent table names.

Jack

Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jack Klebanoff wrote:


>
> 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.

But Derby doesn't use a simple string for a table name, it uses an
object called TableName, which correctly handles the schema, table name
and quoting. Only in this incorrect 'exposed' table name case is a
string used.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBr3HbIv0S4qsbfuQRAv7vAJ9fW2NGBDgikaoDVuIggb7WJRFgkACgmMYH
JPOr+jxZwvC9a84rTKoiBN8=
=VF5A
-----END PGP SIGNATURE-----


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Jack Klebanoff <kl...@Mutagen.Net>.
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 <schma,name>, 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 <regular identifier> and a <delimited identifier> are equivalent 
if the <identifier body> of the <regular identifier> (with every letter 
that is a lower-case letter replaced by the corresponding upper-case 
letter or letters) and the <delimited identifier body> of the <delimited 
identifier> (with all occurrences of <quote> replaced by <quote symbol> 
and all occurrences of <doublequote symbol> replaced by <double quote>), 
considered as the repetition of a <character string literal> that 
specifies a <character set specification> of SQL_IDENTIFIER and an 
implementationdefined collation that is sensitive to case, compare 
equally according to the comparison rules in Subclause 8.2, 
‘‘<comparison predicate>’’". (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

[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jan Hlavat? (JIRA)" <de...@db.apache.org>.
     [ 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 <schma,name>, 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_57080 ]
     
Satheesh Bandaram commented on DERBY-13:
----------------------------------------

I think this is a bind issue, still. For the following query:

select "S1.T1".* from s1.t1; 

"S1.T1" is being considered same as s1.t1. This seems to happen in FromList.java:

public ResultColumnList getResultColumnsForList(String allTableName,ResultColumnList inputRcl,Name tableName)
........................
  /* If allTableName is non-null, then we must check to see if it matches 
  * our exposed name.
  */
  if (allTableName != null && ! allTableName.equals(getExposedName()))
  {
	return null;
  }

If all exposed names are being changed to TableNames, like Dan suggested, then this comparison here should not be a string based comparison.

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jan Hlavat? (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56056 ]
     
Jan Hlavatý commented on DERBY-13:
----------------------------------

I believe SQL92 limits table names to letters, numbers and underscore characters (with underscore and number not being first character of the identifier), so if the first create table statement creates table with actual name "S1.T1" it is probably wrong.

Some syntax definitions from ANSI X3.135-1992:

<table name> ::= <qualified name> | <qualified local table name>
<qualified local table name> ::= MODULE <period> <local table name>
<local table name> ::= <qualified identifier>
<qualified identifier> ::= <identifier>
<qualified name> ::= [ <schema name> <period> ] <qualified identifier>
<identifier> ::= [ <introducer><character set specification> ] <actual identifier>
<actual identifier> ::= <regular identifier> | <delimited identifier>
<regular identifier> ::= <identifier body>
<identifier body> ::= <identifier start> [ { <underscore> | <identifier part> }... ]
<identifier part> ::= <identifier start> | <digit>

1) An <identifier start> is one of:
a) A <simple Latin letter>; or
b) A character that is identified as a letter in the character repertoire identified by the <module character set specification> or by the <character set specification>; or
c) A character that is identified as a syllable in the character repertoire identified by the <module character set specification> or by the <character set specification>; or
d) A character that is identified as an ideograph in the character repertoire identified by the <module character set specification> or by the <character set specification>.


> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]
     
Shreyas Kaushik closed DERBY-13:
--------------------------------


Patch submitted

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: test failures when built & run on linux...(from thread re derby 13)

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shreyas Kaushik wrote:

> Sure, here are the tests that failed,
>
> derbylang/derbylang.fail:lang/desc_index.sql
> derbylang/derbylang.fail:lang/distinctElimination.sql
> derbylang/derbylang.fail:lang/inbetween.sql
> derbylang/derbylang.fail:lang/predicatesIntoViews.sql
> derbylang/derbylang.fail:lang/subqueryFlattening.sql
> derbylang/derbylang.fail:lang/triggerGeneral.sql


I have an idea of why some of these are failing, those that have long
VARCHAR columns with output truncated by ij. They contain diffs with an
& that is the truncation indicator. e.g. predicatesIntoViews.

The output contains runtime statistics output which in turn contains the
text of the SQL statement. The String from getString() of this column
output is truncated by ij as it execeeds the specified maxDisplayWidth.

If the text of the SQL statement is multi-line, or maybe just multi-line
with an initial comment (I haven't looked that deeply) then if Derby is
built on Windows that text contains '\r\n' for the new line(s). If Derby
is built on Unix/Linux the new line will be '\n'. Thus the length of the
runtime statistics String is different and truncating results in a
different last line. Note the new-lines in the rest of the
runtime-statistics output are consistently '\n'.
The actual bug for this could be in reading the script file in ij, how
ij parses SQL statements and passes them onto the engine, or how the
engine obtains the text of the SQL statement for runtime stats.

A quick workaround is to increase the max display width on those tests
to avoid the problem. I will try that and see how many of these tests
will pass that way.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFB5X1YIv0S4qsbfuQRAqhBAJ9VBIbmWv8M205VvgrqM4M+CCYOZQCfS2XX
zFpCzfBtSkFxpQA4YXgwZCU=
=jaAT
-----END PGP SIGNATURE-----


Re: test failures when built & run on linux...(from thread re derby 13)

Posted by Shreyas Kaushik <Sh...@Sun.COM>.
Sure, here are the tests that failed,

derbylang/derbylang.fail:lang/desc_index.sql
derbylang/derbylang.fail:lang/distinctElimination.sql
derbylang/derbylang.fail:lang/inbetween.sql
derbylang/derbylang.fail:lang/predicatesIntoViews.sql
derbylang/derbylang.fail:lang/subqueryFlattening.sql
derbylang/derbylang.fail:lang/triggerGeneral.sql

I have atatched the full report of the test run in JIRA for Derby-13.

thanks
Shreyas

myrnap wrote:

> Daniel John Debrunner wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Shreyas Kaushik (JIRA) wrote:
>>  
>>
>>>     [
>>>   
>>
>> http://issues.apache.org/jira/browse/DERBY-13?page=comments#action_57179 
>> ]
>>  
>>
>>> I also ran the tests of derbylang and am attaching the diffs of them
>>>   
>>
>> as well. Some of the tests fail there and I don't know the exact reason
>> for the failures.( I think they are not failures )
>>
>> I actually think you are seeing unrelated failures. It seems that if
>> Derby is built and tested on linix or unix then about six tests fail, it
>> looks like a difference in the number of characters in a long line. I'm
>> not sure if it's the build process, ij or the test diff program that has
>> the problem. If you build on Windows and test on linux or unix the all
>> the tests pass.
>>
>> Dan.
>>
>>  
>>
> Hi, Can you tell me which tests fail? Maybe it should be at least 
> documented.
>
> Thx,
> Myrna



test failures when built & run on linux...(from thread re derby 13)

Posted by myrnap <my...@Golux.Com>.
Daniel John Debrunner wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Shreyas Kaushik (JIRA) wrote:
>  
>
>>     [
>>    
>>
>http://issues.apache.org/jira/browse/DERBY-13?page=comments#action_57179 ]
>  
>
>>I also ran the tests of derbylang and am attaching the diffs of them
>>    
>>
>as well. Some of the tests fail there and I don't know the exact reason
>for the failures.( I think they are not failures )
>
>I actually think you are seeing unrelated failures. It seems that if
>Derby is built and tested on linix or unix then about six tests fail, it
>looks like a difference in the number of characters in a long line. I'm
>not sure if it's the build process, ij or the test diff program that has
>the problem. If you build on Windows and test on linux or unix the all
>the tests pass.
>
>Dan.
>
>  
>
Hi, Can you tell me which tests fail? Maybe it should be at least 
documented.

Thx,
Myrna

Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shreyas Kaushik (JIRA) wrote:
>      [
http://issues.apache.org/jira/browse/DERBY-13?page=comments#action_57179 ]
>
> Shreyas Kaushik commented on DERBY-13:
> --------------------------------------
>
> I am proposing a fix for this issue. I am attaching the diffs of all
the files that need to have changes.
>
> As per the discussions we have had on this issue the problem was with
comparing exposed names. I have changed the comparision of all exposed
names to the TableName objects.
>
> As Sateesh had suggested in one of his earlier mails on this issue,
>
> public ResultColumnList getResultColumnsForList(String
allTableName,ResultColumnList inputRcl,Name tableName)
>
>  method in the FromTable.java the "allTableName" needs to be a
TableName object instead of a String object. I have made those changes
as well for the comparision to happen between TableName objects.
>
>   For the above change to happen we need to get a handle to the
TableName object that is stored in the
java/engine/org/apache/derby/impl/sql/compile/AllResultColumn. As of now
it does not have a method to actually get a handle to the TableName
object stored in this. So I added a new method that returns a handle to
the TableName object stored internally.
>
> I also ran the tests of derbylang and am attaching the diffs of them
as well. Some of the tests fail there and I don't know the exact reason
for the failures.( I think they are not failures )

I actually think you are seeing unrelated failures. It seems that if
Derby is built and tested on linix or unix then about six tests fail, it
looks like a difference in the number of characters in a long line. I'm
not sure if it's the build process, ij or the test diff program that has
the problem. If you build on Windows and test on linux or unix the all
the tests pass.

Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFB2YEXIv0S4qsbfuQRAqK2AJ9j0+VWZyBTvDG2I0CuPtND6mnWGgCfXpUs
Nd4OzchMh0E550yTvTczFvM=
=iQmd
-----END PGP SIGNATURE-----


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=comments#action_57179 ]
     
Shreyas Kaushik commented on DERBY-13:
--------------------------------------

I am proposing a fix for this issue. I am attaching the diffs of all the files that need to have changes.

As per the discussions we have had on this issue the problem was with comparing exposed names. I have changed the comparision of all exposed names to the TableName objects. 

As Sateesh had suggested in one of his earlier mails on this issue,  

public ResultColumnList getResultColumnsForList(String allTableName,ResultColumnList inputRcl,Name tableName)

 method in the FromTable.java the "allTableName" needs to be a TableName object instead of a String object. I have made those changes as well for the comparision to happen between TableName objects.

  For the above change to happen we need to get a handle to the TableName object that is stored in the java/engine/org/apache/derby/impl/sql/compile/AllResultColumn. As of now it does not have a method to actually get a handle to the TableName object stored in this. So I added a new method that returns a handle to the TableName object stored internally.

I also ran the tests of derbylang and am attaching the diffs of them as well. Some of the tests fail there and I don't know the exact reason for the failures.( I think they are not failures )

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=history ]

Shreyas Kaushik updated DERBY-13:
---------------------------------

    Attachment: derbylang_report.txt

Test run report with diffs of tests that are failing

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Rick Post (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56067 ]
     
Rick Post commented on DERBY-13:
--------------------------------

I think that the proposed patch is either incorrect or incomplete.

1. There are two 'equals' methods in Tablename.java: one takes only a table name argument and the other takes both table name and schema name arguments. Don't they both need to be modified?

2. The proposed change to the first 'equals' method in  Tablename.java returns false if the argument table name is null. But the comment block at the beginning of the method states that 'TableNames are equal if their both their schemaNames and tableNames are
	 * equal, or if this node's full table name is null'. If this comment is correct then 'true' should be returned if 'this nodes full table name is null' whether the argument is null or not. If this comment is not correct then it should be corrected. Since the same comment appears before the second 'equals' method the second method will need to be modified to reflect the same business rule.
 before the 



> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jack Klebanoff (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]

Jack Klebanoff reassigned DERBY-13:
-----------------------------------

    Assign To:     (was: Jack Klebanoff)

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56109 ]
     
Daniel John Debrunner commented on DERBY-13:
--------------------------------------------

Rather than inventing a new way, the exposed table name should be a TableName rather than a simple String. (org.apache.derby.impl.sql.compile.TableName). Some of the query nodes already have a method TableName getExposedTableName(), all instances and uses of String getExposedName() should be changed to TableName getExposedTableName().

The change is probably a little more involved than that, but that should be the general idea.

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_57002 ]
     
Shreyas Kaushik commented on DERBY-13:
--------------------------------------

In response to Sateesh's comments:

 Should the behaviour for the two queries you mentioned in your example, be taken care of at the compile time or bind time ? I feel they should be probably under a seperate bug, shouldn't they ? As this is likely to have a much larger impact.

For this bug it is how the from list behaves and the comparision that needs to go in here, as Dan has suggested used the getExposedTableName approach.



> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=all ]
     
Shreyas Kaushik resolved DERBY-13:
----------------------------------

    Resolution: Fixed

Fixed, as per the earlier comment from Dan

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-13?page=comments#action_57923 ]
     
Daniel John Debrunner commented on DERBY-13:
--------------------------------------------

Committed patch from Shreyas Kaushik <Sh...@Sun.COM>

svn revision 125980

> Quoted names with embedded period mishandled in from list
> ---------------------------------------------------------
>
>          Key: DERBY-13
>          URL: http://issues.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.diff, Derby-13.patch, derbylang_report.txt
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_56078 ]
     
Satheesh Bandaram commented on DERBY-13:
----------------------------------------

I believe the proposed patch is incorrect. The patch would incorrectly accept statements like 
select * from t1 a, t2 a where a.i = 5

The current checking for duplicate exposed names is correct. I think the problem here is caused because Derby currently stores both S1.T1 and "S1.T1" tables as having the same exposed name, S1.T1. At the compile time, we are not able tell if it was originally S1.T1 or "S1.T1"

One solution might be to store "delimited identifiers" along with their quotes... In this case, one table would have the exposed name S1.T1 and the other "S1.T1". But this might have impact on some other parts of the code.

Note that following queries are currently accepted, when both should fail:
ij> select s1.t1.* from "S1.T1";
ID         |D1
-----------------------

0 rows selected
ij>  select "S1.T1".* from s1.t1;
ID         |D2
-----------------------

0 rows selected



> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Jan Hlavatý commented on DERBY-13:
> ----------------------------------
>
> Maybe the table names could be converted to canonical form before
being used/compared?
> After all, s1.t1 is just an easy way to write "S1"."T1", and should be
threated as such.

Why not use the existing mechanism that already works, TableName?

It has an equals method that compares correctly and correctly handles
schema and table names.

As I said earlier treating exposed names as TableNames and not Strings
is most likely the way to go to fix this bug. I don't think anyone has
tried this.


Dan.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFB0ZZIIv0S4qsbfuQRArhWAJ40a2QoJVSOCWy3NWiPu3tqsPeUhQCgoht5
4B4XoKHOaquWEf1XvV5Ssz4=
=IXB2
-----END PGP SIGNATURE-----


[jira] Commented: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Jan Hlavat? (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=comments#action_57083 ]
     
Jan Hlavatý commented on DERBY-13:
----------------------------------

Maybe the table names could be converted to canonical form before being used/compared?
After all, s1.t1 is just an easy way to write "S1"."T1", and should be threated as such.


> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-13) Quoted names with embedded period mishandled in from list

Posted by "Shreyas Kaushik (JIRA)" <de...@db.apache.org>.
     [ http://nagoya.apache.org/jira/browse/DERBY-13?page=history ]

Shreyas Kaushik updated DERBY-13:
---------------------------------

    Attachment: Derby-13.patch

Attached is the patch for this bug. Please review and give comments.

> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira