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 rh...@apache.org on 2012/07/12 20:28:09 UTC

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

Author: rhillegas
Date: Thu Jul 12 18:28:09 2012
New Revision: 1360846

URL: http://svn.apache.org/viewvc?rev=1360846&view=rev
Log:
DERBY-5779: Add more tests for illegal joins of VTI/tableFunction args in <joined table> clauses.

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=1360846&r1=1360845&r2=1360846&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java Thu Jul 12 18:28:09 2012
@@ -2076,24 +2076,94 @@ public class TableFunctionTest extends B
              BAD_ARG_JOIN,
              "select tt.* from table(syscs_diag.space_table(st.tablename)) tt join sys.systables st using(tableid)"
              );
-        // table function arg joining to another table in a <joined table> clause
         expectError
             (
              BAD_ARG_JOIN,
-             "select tt.* from table( lowerCaseRow(st.tablename)) tt join sys.systables st on tt.contents = st.tablename"
+             "select tt.* from sys.systables st join table(syscs_diag.space_table(st.tablename)) tt using(tableid)"
              );
-        // diagnostic vti arg joining to another table in a <joined table> clause
         expectError
             (
              BAD_ARG_JOIN,
              "select tt.* from table(syscs_diag.space_table(st.tablename)) tt right join sys.systables st using(tableid)"
              );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from sys.systables st right join table(syscs_diag.space_table(st.tablename)) tt using(tableid)"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from table(syscs_diag.space_table(st.tablename)) tt left join sys.systables st using(tableid)"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from sys.systables st left join table(syscs_diag.space_table(st.tablename)) tt using(tableid)"
+             );
         // table function arg joining to another table in a <joined table> clause
         expectError
             (
              BAD_ARG_JOIN,
+             "select tt.* from table( lowerCaseRow(st.tablename)) tt join sys.systables st on tt.contents = st.tablename"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from sys.systables st join table( lowerCaseRow(st.tablename)) tt on tt.contents = st.tablename"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
              "select tt.* from table( lowerCaseRow(st.tablename)) tt right join sys.systables st on tt.contents = st.tablename"
              );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from sys.systables st right join table( lowerCaseRow(st.tablename)) tt on tt.contents = st.tablename"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from table( lowerCaseRow(st.tablename)) tt left join sys.systables st on tt.contents = st.tablename"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from sys.systables st left join table( lowerCaseRow(st.tablename)) tt on tt.contents = st.tablename"
+             );
+        // 3-way <joined table>
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from ( table(syscs_diag.space_table('foo')) tt join sys.systables st using(tableid) ) join table(syscs_diag.space_table(st.tablename)) tr using(tableid)"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from ( table( lowerCaseRow('foo')) tt join sys.systables st on tt.contents = st.tablename ) join table( lowerCaseRow(st.tablename)) tr on tr.contents = st.tablename"
+             );
+        // cross joins
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from table(syscs_diag.space_table(st.tablename)) tt cross join sys.systables st"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from table( lowerCaseRow(st.tablename)) tt cross join sys.systables st"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from ( table(syscs_diag.space_table('foo')) tt cross join sys.systables st ) cross join table(syscs_diag.space_table(st.tablename)) tr"
+             );
+        expectError
+            (
+             BAD_ARG_JOIN,
+             "select tt.* from ( table( lowerCaseRow('foo')) tt cross join sys.systables st ) cross join table( lowerCaseRow(st.tablename)) tr"
+             );
 
         // pre-existing error not affected: table function correlated
         // to inner query block
@@ -2104,8 +2174,6 @@ public class TableFunctionTest extends B
              "from table( lowerCaseRow( cast( t.tablename as varchar(32672)) ) ) s\n" +
              "where exists ( select tableid from sys.systables t )\n"
              );
-
-        //???;
     }
     
     /**