|
Yip, I reviewed the code and it looks good to me. For the tests, should we have a test case where a correlation name is used in order by? May be there is already such a test or may be this test will not test the changes you made but here is a test case based on the sql script included in this Jira entry
set schema test2; select testtable.id as c1 from testtable order by c1; Yip, I have a feeling that I missing something obvious here but why should following statement (towards the end of the tests that you added) fail?
select t1.id as c1 from t1 where c1 > 0 order by c1; Good question, Mamta. This is actually not related to synonym. If you do issue the query not using synonym below, it will also fail in Derby.
select t1.id as c1 from t1 where c1 > 0 order by c1; One reason is the derived column can be an aggregate function, such as count(*), which can be aliased. select count(t1.id) as cnt from t1 where cnt > 1; This is illegal, since where clause semantics does not allow this. Thanks, Yip. I have no more questions on the patch and I give it a +1.
committed to trunk:
m3_ibm142:172>svn commit Sending java\engine\org\apache\derby\impl\sql\compile\FromBaseTable.java Sending java\testing\org\apache\derbyTesting\functionTests\master\synonym .out Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\syn onym.sql Transmitting file data ... Committed revision 452259. merged from trunk to 10.1 branch:
m101_142:12>svn commit Sending java\engine\org\apache\derby\impl\sql\compile\FromBaseTable.java Sending java\testing\org\apache\derbyTesting\functionTests\master\synonym .out Sending java\testing\org\apache\derbyTesting\functionTests\tests\lang\syn onym.sql Transmitting file data ... Committed revision 452269. backported fix from trunk to 10.2.1.7 (version does not exist in jira right now - so marked fixed in 10.2.2)
fix has made it to trunk, 10.2 branch and 10.1 branch
This issue has been resolved for over a year with no further movement. Closing.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DERBY-1894. The fix is in FromBaseTable's getFromTableByName() method, where it is using theresolved synonym table name to do the binding for ORDER BY column.
Patch includes additional tests and derbyall passes. Appreciate if someone
can review it. Thanks.