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 bp...@apache.org on 2006/11/11 01:51:33 UTC

svn commit: r473603 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/CreateViewNode.java testing/org/apache/derbyTesting/functionTests/master/views.out testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql

Author: bpendleton
Date: Fri Nov 10 16:51:33 2006
New Revision: 473603

URL: http://svn.apache.org/viewvc?view=rev&rev=473603
Log:
DERBY-2018: NullPointerException in CREATE VIEW ... VALUES NULL

This patch was contributed by Yip Ng (yipng168@gmail.com)

This fix catches untyped null in CreateViewNode at bind phase (same logic
as CursorNode) and throws the exception. 

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/views.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java?view=diff&rev=473603&r1=473602&r2=473603
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java Fri Nov 10 16:51:33 2006
@@ -276,6 +276,10 @@
 
 			// bind the query expression
 			queryExpr.bindResultColumns(fromList);
+			
+			// rejects any untyped nulls in the RCL
+			// e.g.:  CREATE VIEW v1 AS VALUES NULL
+			queryExpr.bindUntypedNullsToResultColumns(null);
 		}
 		finally
 		{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/views.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/views.out?view=diff&rev=473603&r1=473602&r2=473603
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/views.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/views.out Fri Nov 10 16:51:33 2006
@@ -386,4 +386,8 @@
 0 rows inserted/updated/deleted
 ij> DROP SCHEMA TEST_SCHEMA RESTRICT;
 0 rows inserted/updated/deleted
+ij> -- DERBY-2018
+-- expect error
+CREATE VIEW v1(c1) AS VALUES NULL;
+ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT statement.
 ij> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql?view=diff&rev=473603&r1=473602&r2=473603
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql Fri Nov 10 16:51:33 2006
@@ -199,3 +199,7 @@
 DROP VIEW TEST_SCHEMA.V1; 
 DROP TABLE TEST_SCHEMA.T1;
 DROP SCHEMA TEST_SCHEMA RESTRICT; 
+
+-- DERBY-2018
+-- expect error
+CREATE VIEW v1(c1) AS VALUES NULL;