You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2011/03/20 01:22:20 UTC

svn commit: r1083353 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/compile/ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/

Author: kmarsden
Date: Sun Mar 20 00:22:19 2011
New Revision: 1083353

URL: http://svn.apache.org/viewvc?rev=1083353&view=rev
Log:
DERBY-5005 Error when fully qualifying a field from a view in an ORDER BY clause


Added:
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Derby5005Test.java
      - copied unchanged from r1069661, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Derby5005Test.java
Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Mar 20 00:22:19 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.6:942027,957000,957287,958621,962738,965351,987678,997790*,1031623,1055601,1068474,1071167
-/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803336,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,826263,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,891350,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,931076,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952237,952581,954748,955001,955634,956075,956445,956659,957260,958163,958618,959550,961892,962716,964039,964402,96
 5647,966393,967201,967304,980089,980684,986689,986834,987539,989099,997325*,998170,999119,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1030043,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1081455
+/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803336,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,826263,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,891350,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,931076,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952237,952581,954748,955001,955634,956075,956445,956659,957260,958163,958618,959550,961892,962716,964039,964402,96
 5647,966393,967201,967304,980089,980684,986689,986834,987539,989099,997325*,998170,999119,999485,1002291,1002682,1002853,1021426,1024511,1024528,1025615,1025795,1030043,1040658,1053724,1055169,1062096,1063809,1065061,1067250,1069661,1071886,1081455

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java?rev=1083353&r1=1083352&r2=1083353&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java Sun Mar 20 00:22:19 2011
@@ -137,7 +137,19 @@ public class FromSubquery extends FromTa
 	protected FromTable getFromTableByName(String name, String schemaName, boolean exactMatch)
 		throws StandardException
 	{
-		return super.getFromTableByName(name, schemaName, exactMatch);
+        if (schemaName != null && origTableName != null) {
+            // View can have schema
+            if (!schemaName.equals(origTableName.schemaName)) {
+                return null;
+            }
+            // So far, so good, now go on to compare table name
+        }
+
+        if (getExposedName().equals(name)) {
+            return this;
+        }
+
+        return null;
 	}
 
 	/**

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out?rev=1083353&r1=1083352&r2=1083353&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out Sun Mar 20 00:22:19 2011
@@ -2234,4 +2234,7 @@ ij> select k as s from d3303 group by i,
 ERROR 42X77: Column position '2' is out of range for the query expression.
 ij> drop table d3303;
 0 rows inserted/updated/deleted
+ij> -- See also Derby5005.java which should be merged with this test when
+-- it gets converted to JUnit.
+;
 ij> 

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql?rev=1083353&r1=1083352&r2=1083353&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/orderby.sql Sun Mar 20 00:22:19 2011
@@ -859,3 +859,6 @@ select k from d3303 group by i,k order b
 select k as s from d3303 group by i,k order by 2;
 
 drop table d3303;
+
+-- See also Derby5005.java which should be merged with this test when
+-- it gets converted to JUnit.