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 ma...@apache.org on 2012/02/23 21:25:28 UTC

svn commit: r1292941 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Author: mamta
Date: Thu Feb 23 20:25:28 2012
New Revision: 1292941

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

Test create view with insert rows from 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=1292941&r1=1292940&r2=1292941&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 Thu Feb 23 20:25:28 2012
@@ -562,6 +562,25 @@ public void testUsingClauseAndNaturalJoi
       		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 USING(x))");
       checkLangBasedQuery(s, "SELECT * FROM derby4631_t3",
         		null);
+
+      //Test create view with insert from join
+      s.executeUpdate("create view derby4631_v2 as " +
+      		"(SELECT x," +
+      		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+      		"FROM derby4631_t2 NATURAL LEFT OUTER JOIN derby4631_t1)");
+      checkLangBasedQuery(s, "SELECT * FROM derby4631_v2 ",
+      		new String[][] {{"b","b"},{"c","c"}});
+      s.executeUpdate("drop view derby4631_v2 ");
+      //Do the same test as above, but this time using the USING clause
+      // rather the NATURAL join
+      s.executeUpdate("create view derby4631_v2 as " +
+      		"(SELECT x," +
+      		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+      		"FROM derby4631_t2 LEFT OUTER JOIN derby4631_t1 USING(x))");
+      checkLangBasedQuery(s, "SELECT * FROM derby4631_v2 ",
+      		new String[][] {{"b","b"},{"c","c"}});
+      s.executeUpdate("drop view derby4631_v2 ");
+
       //Test nested NATURAL LEFT OUTER JOIN. They will return correct data
       // with both territory and non-territory based dbs.
       checkLangBasedQuery(s, "SELECT x " +
@@ -638,6 +657,24 @@ public void testUsingClauseAndNaturalJoi
           		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 USING(x))");
           checkLangBasedQuery(s, "SELECT * FROM derby4631_t3",
             		null);
+
+          //Test create view with insert from join
+          s.executeUpdate("create view derby4631_v2 as " +
+          		"(SELECT x," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+          		"FROM derby4631_t2 NATURAL RIGHT OUTER JOIN derby4631_t1)");
+          checkLangBasedQuery(s, "SELECT * FROM derby4631_v2 ",
+          		new String[][] {{"A","A"},{"B","b"}});
+          s.executeUpdate("drop view derby4631_v2 ");
+          //Do the same test as above, but this time using the USING clause
+          // rather the NATURAL join
+          s.executeUpdate("create view derby4631_v2 as " +
+          		"(SELECT x," +
+          		"coalesce(derby4631_t2.x, derby4631_t1.x) cx " +
+          		"FROM derby4631_t2 RIGHT OUTER JOIN derby4631_t1 USING(x))");
+          checkLangBasedQuery(s, "SELECT * FROM derby4631_v2 ",
+          		new String[][] {{"A","A"},{"B","b"}});
+          s.executeUpdate("drop view derby4631_v2 ");
           
           //Test nested NATURAL RIGHT OUTER JOIN
           checkLangBasedQuery(s, "SELECT x " +
@@ -830,7 +867,6 @@ public void testUsingClauseAndNaturalJoi
       s.executeUpdate("DROP VIEW derby4631_v2");
       s.executeUpdate("DROP TABLE derby4631_t1");
       s.executeUpdate("DROP TABLE derby4631_t2");
-      
 }
 
 private void joinTesting(Statement s,