db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shreyas Kaushik <Shreyas.Kaus...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-18) Exposed name matching has bugs when the column name is qualified with a schema name.
Date Fri, 28 Jan 2005 04:23:38 GMT
Dan,

I did the patch for this.

 From your comments I looked at the getSchemaDescriptor() in 
QueryTreeNode. The schema name was getting
stored there but not stored in the TableName in the corresponding node.

Since *null* schema implies current schema I just called bind() in 
TableName.java whereever the schema was null.
By calling this proper schema names get stored. I had to do these 
changes in some of the file where the method
getMatchingColumn() is called so that TableName comparisions happen on 
objects that have the correct data.

When put this patch and ran the tests I had some failures which were 
becasue the error messages were different.
This is because in the earlier file, if the error message had "S1.T1" 
now it has "APP.S1.T1" hence the failures.

I am attaching the patch and the test run results.

thanks
Shreyas

Daniel John Debrunner wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Shreyas Kaushik (JIRA) wrote:
>  
>
>>     [
>>    
>>
>http://issues.apache.org/jira/browse/DERBY-18?page=comments#action_58008 ]
>  
>
>>Shreyas Kaushik commented on DERBY-18:
>>--------------------------------------
>>
>>set current schema app;
>>
>>create table t1(int c1 varchar(10));
>>
>>create schema s1;
>>create table s1.t1(id1 int, d2 varchar(10));
>>
>>select * from t1, app.t1;  ---> This fails, should succeed.
>>
>>Internally table names are handled correctly but the above problem
>>    
>>
>occurs because of the equals() method in Tablename.java.
>  
>
>>Here the follwoing piece of code
>>
>>
>>    
>>
>-
>----------------------------------------------------------------------------------
>  
>
>>else if ((schemaName == null) ||
>>				 (otherTableName.getSchemaName() == null))
>>		{
>>			return tableName.equals(otherTableName.getTableName());
>>	     }
>>
>>    
>>
>-
>----------------------------------------------------------------------------------
>  
>
>>causes the above error to occur. In this if either of the schema name
>>    
>>
>is null, only the table names are compared and hence the error for the
>above statement.
>  
>
>>Should the equals method implementation be changed to take of this?
>>  or
>>Should we set the tables that have null schemas to the current schema
>>    
>>
>or something along these lines?
>
>Any implicit schema always means the current schema. At bind time the
>query node should ensure that it converts implicit schema names to the
>current schema. This is handled by the
>QueryTreeNode.getSchemaDescriptor() methods. Most likely this is
>occuring but the node's TableName is not being updated.
>
>Dan.
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.5 (MingW32)
>Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
>iD8DBQFB9qR9Iv0S4qsbfuQRAvFMAJ4+Ujvl1x8Yp9DL9zFgHO8KnxQNiwCg0H6A
>HJ2QJcOVQncp5gYEVrKG7C8=
>=SZnN
>-----END PGP SIGNATURE-----
>
>  
>

Mime
View raw message