db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r835996 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Date Fri, 13 Nov 2009 21:23:42 GMT
Author: mamta
Date: Fri Nov 13 21:23:35 2009
New Revision: 835996

URL: http://svn.apache.org/viewvc?rev=835996&view=rev
Log:
Backporting DERBY-4365 into 10.5 codeline. 


Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 13 21:23:35 2009
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,833430

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java?rev=835996&r1=835995&r2=835996&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
Fri Nov 13 21:23:35 2009
@@ -87,6 +87,23 @@
 	}
 
 	/**
+	 * DERBY-4365
+	 * Bind untyped nulls to the types in the given ResultColumnList.
+	 * This is used for binding the nulls in row constructors and
+	 * table constructors.  
+	 *
+	 * @param rcl	The ResultColumnList with the types to bind nulls to
+	 *
+	 * @exception StandardException		Thrown on error
+	 */
+	public void bindUntypedNullsToResultColumns(ResultColumnList rcl)
+	throws StandardException
+	{
+		leftResultSet.bindUntypedNullsToResultColumns(rcl);
+		rightResultSet.bindUntypedNullsToResultColumns(rcl);
+	}
+
+	/**
 	 * @see Optimizable#modifyAccessPath
 	 *
 	 * @exception StandardException		Thrown on error

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java?rev=835996&r1=835995&r2=835996&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Fri Nov 13 21:23:35 2009
@@ -34,6 +34,8 @@
  * Test cases for JOINs.
  */
 public class JoinTest extends BaseJDBCTestCase {
+    private static final String VALUES_WITH_NULL = "42X07";
+
     public JoinTest(String name) {
         super(name);
     }
@@ -43,6 +45,36 @@
     }
 
     /**
+     * DERBY-4365 Test that the NULL values are caught in VALUES clause when it
+     * is part of a non-INSERT statement. Throw exception 42X07 for such a 
+     * case.
+     * 
+     */
+    public void testNullabilityInValues() throws SQLException {
+        Statement s = createStatement();
+        assertStatementError(
+        		VALUES_WITH_NULL, s, 
+        		"select a.* from (values (null)) a left outer join "+
+        		"(values ('a')) b on 1=1");
+        assertStatementError(
+        		VALUES_WITH_NULL, s, 
+        		"select a.* from (values (null)) a");
+
+        String[][] expectedResult = {
+            {"a"},
+            {"a"},
+            {"b"},
+            {"b"},
+            {null},
+            {null}
+        };
+        JDBC.assertUnorderedResultSet(s.executeQuery(
+        		"select a.* from (values ('a'),('b'),(cast(null as char(1)))) "
+        		+ "a left outer join (values ('c'),('d')) b on 1=1"), 
+        		expectedResult);
+    }
+
+    /**
      * Test that the columns returned by a left or right outer join have the
      * correct nullability. In a left outer join, the columns from the left
      * side of the join should have their original nullability, and all the



Mime
View raw message