db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1229266 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Date Mon, 09 Jan 2012 17:29:12 GMT
Author: mamta
Date: Mon Jan  9 17:29:11 2012
New Revision: 1229266

URL: http://svn.apache.org/viewvc?rev=1229266&view=rev
Log:
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based
collation

Adding variations of existing test but using USING clause rather than NATURAL JOIN.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?rev=1229266&r1=1229265&r2=1229266&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Mon Jan  9 17:29:11 2012
@@ -526,6 +526,14 @@ public void testUsingClauseAndNaturalJoi
           		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
         		"FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1",
           		new String[][] {{"A","A"},{"B","b"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, " +
+            		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+              		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 " +
+            		"USING(x)",
+            		new String[][] {{"A","A"},{"B","b"}});
+
           //Derby always picks up the join column's value from the left table
           // when working with LEFT OUTER JOIN. This logic deos not cause any
           // issue with territory or non-territory based databases. We get 
@@ -540,6 +548,13 @@ public void testUsingClauseAndNaturalJoi
           		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
         		"FROM derby4631_t2 NATURAL LEFT OUTER JOIN derby4631_t1",
           		new String[][] {{"b","b"},{"c","c"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, " +
+            		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+              		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 " +
+            		"USING(x)",
+            		new String[][] {{"b","b"},{"c","c"}});
       } else {
     	  //We are working with a database with case-sensitive collation.
     	  // For the given data, RIGHT OUTER JOIN will not find any 
@@ -549,6 +564,14 @@ public void testUsingClauseAndNaturalJoi
           		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
         		"FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1",
           		new String[][] {{"A","A"},{"B","B"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, " +
+            		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+              		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 " +
+            		"USING(x)",
+            		new String[][] {{"A","A"},{"B","B"}});
+
           //Same is true for LEFT OUTER JOIN for the given data. None of the
           // rows in the left table match the rows in the right table and hence
           // it will be ok for Derby to pick up join column's value from left
@@ -557,8 +580,16 @@ public void testUsingClauseAndNaturalJoi
           		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
         		"FROM derby4631_t2 NATURAL LEFT OUTER JOIN derby4631_t1",
           		new String[][] {{"b","b"},{"c","c"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, " +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+          		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 " +
+        		"USING(x)",
+        		new String[][] {{"b","b"},{"c","c"}});
       }
-      s.executeUpdate("DROP TABLE derby4631_t1");
+          	  
+   	  s.executeUpdate("DROP TABLE derby4631_t1");
       s.executeUpdate("DROP TABLE derby4631_t2");
       
       //Now do the testing with 2 join columns
@@ -573,22 +604,56 @@ public void testUsingClauseAndNaturalJoi
           		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
         		"FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1",
           		new String[][] {{"A","z","A","z"},{"B","y","b","Y"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, y," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
+          		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
+        		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 " +
+          		"USING(x,y)",
+          		new String[][] {{"A","z","A","z"},{"B","y","b","Y"}});
+
           checkLangBasedQuery(s, "SELECT x, y," +
           		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
           		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
         		"FROM derby4631_t2 NATURAL LEFT OUTER JOIN derby4631_t1",
           		new String[][] {{"b","Y","b","Y"},{"c","x","c","x"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, y," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
+          		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
+        		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 " +
+          		"USING(x,y)",
+          		new String[][] {{"b","Y","b","Y"},{"c","x","c","x"}});
       } else {
           checkLangBasedQuery(s, "SELECT x, y," +
             		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
             		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
             		"FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1",
               		new String[][] {{"A","z","A","z"},{"B","y","B","y"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, y," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
+          		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
+          		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 " +
+          		"USING(x,y)",
+        		new String[][] {{"A","z","A","z"},{"B","y","B","y"}});
+
           checkLangBasedQuery(s, "SELECT x, y," +
             		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
             		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
             		"FROM derby4631_t2 NATURAL LEFT OUTER JOIN derby4631_t1",
               		new String[][] {{"b","Y","b","Y"},{"c","x","c","x"}});
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          checkLangBasedQuery(s, "SELECT x, y," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx, " +
+          		"coalesce(derby4631_t2.y, derby4631_t1.y) cy " +
+          		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 " +
+          		"USING(x,y)",
+        		new String[][] {{"b","Y","b","Y"},{"c","x","c","x"}});
       }
       s.executeUpdate("DROP TABLE derby4631_t1");
       s.executeUpdate("DROP TABLE derby4631_t2");



Mime
View raw message