db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1588455 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java engine/org/apache/derby/loc/messages.xml testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java
Date Fri, 18 Apr 2014 12:22:53 GMT
Author: rhillegas
Date: Fri Apr 18 12:22:53 2014
New Revision: 1588455

URL: http://svn.apache.org/r1588455
Log:
DERBY-6545: Prevent ALTER TABLE from adding a default to an identity column; commit derby-6545-01-aa-forbidDefaultOnIdentityColumn.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java?rev=1588455&r1=1588454&r2=1588455&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ModifyColumnNode.java
Fri Apr 18 12:22:53 2014
@@ -372,7 +372,7 @@ class ModifyColumnNode extends ColumnDef
         { defaultInfo = (DefaultInfoImpl)cd.getDefaultInfo(); }
         else
         {
-            if ( cd.hasGenerationClause() )
+            if ( cd.hasGenerationClause() || cd.isAutoincrement() )
             {
 				throw StandardException.newException( SQLState.LANG_GEN_COL_DEFAULT, cd.getColumnName()
);
             }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=1588455&r1=1588454&r2=1588455&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Fri Apr 18 12:22:53
2014
@@ -2213,7 +2213,7 @@ Guide.
 
             <msg>
                 <name>42XA7</name>
-                <text>'{0}' is a generated column. You cannot change its default value.</text>
+                <text>'{0}' is a generated or identity column. You cannot change its
default value.</text>
                 <arg>columnName</arg>
             </msg>
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java?rev=1588455&r1=1588454&r2=1588455&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/AutoIncrementTest.java
Fri Apr 18 12:22:53 2014
@@ -137,8 +137,6 @@ public class AutoIncrementTest extends B
 		st.execute("create table D1644_B (d1644_Bc1 int generated by default as identity)");
 		st.execute("create table d4006 (x varchar(5) default 'abc')");
 		st.execute("create table d4006_a (z int generated always as identity)");
-		st.execute("alter table d4006_a alter column z default 99");
-		st.execute("alter table d4006_a alter column z default null");
 		st.execute("create table d4419_t1(x int)");
 		st.execute("insert into d4419_t1 values 1,2");
 		st.execute("create table d4419_t2(x int)");
@@ -1157,6 +1155,8 @@ public class AutoIncrementTest extends B
 		assertStatementError("42XA7",s,"alter table d4006 alter column y default 42");
 		assertStatementError("42XA7",s,"alter table d4006 alter column y default null");
 
+		assertStatementError( "42XA7", s, "alter table d4006_a alter column z default 99" );
+		assertStatementError( "42XA7", s, "alter table d4006_a alter column z default null" );
 	}
 	
 	public static Test suite() {



Mime
View raw message