db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1087457 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/AlterTableNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
Date Thu, 31 Mar 2011 22:02:56 GMT
Author: rhillegas
Date: Thu Mar 31 22:02:55 2011
New Revision: 1087457

URL: http://svn.apache.org/viewvc?rev=1087457&view=rev
Log:
DERBY-5160: Fix NPE when adding a column without specifying a datatype.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java?rev=1087457&r1=1087456&r2=1087457&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
Thu Mar 31 22:02:55 2011
@@ -352,6 +352,12 @@ public String statementToString()
                         //
 
                         if ( cdn.hasGenerationClause() && ( cdn.getType() == null
) ) { continue; }
+
+                        if ( cdn.getType() == null )
+                        {
+                            throw StandardException.newException
+                                ( SQLState.LANG_NEEDS_DATATYPE, cdn.getColumnName() );
+                        }
                         
 						if (cdn.getType().getTypeId().isStringTypeId()) {
 							//we found what we are looking for. Set the 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java?rev=1087457&r1=1087456&r2=1087457&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AlterTableTest.java
Thu Mar 31 22:02:55 2011
@@ -130,6 +130,10 @@ public final class AlterTableTest extend
         assertStatementError("X0Y32", st,
                 "alter table t0 add column c1 int");
 
+        // add a column without a datatype (DERBY-5160)
+        assertStatementError("42XA9", st,
+                "alter table t0 add column y");
+
         // alter a system table
         assertStatementError("42X62", st,
                 "alter table sys.systables add column c1 int");



Mime
View raw message