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/10/15 17:35:30 UTC

svn commit: r464215 [3/3] - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/functionTests/master/ testing/org...

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_3.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/syscat.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/syscat.out?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/syscat.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/syscat.out Sun Oct 15 08:35:27 2006
@@ -210,7 +210,7 @@
 SYSSCHEMAS                                                                                                                      |AUTHORIZATIONID                                                                                                                 |3          |VARCHAR(128) N&
 SYSSCHEMAS                                                                                                                      |SCHEMAID                                                                                                                        |1          |CHAR(36) NOT N&
 SYSSCHEMAS                                                                                                                      |SCHEMANAME                                                                                                                      |2          |VARCHAR(128) N&
-SYSSTATEMENTS                                                                                                                   |COMPILATIONSCHEMAID                                                                                                             |8          |CHAR(36) NOT N&
+SYSSTATEMENTS                                                                                                                   |COMPILATIONSCHEMAID                                                                                                             |8          |CHAR(36)       
 SYSSTATEMENTS                                                                                                                   |LASTCOMPILED                                                                                                                    |7          |TIMESTAMP      
 SYSSTATEMENTS                                                                                                                   |SCHEMAID                                                                                                                        |3          |CHAR(36) NOT N&
 SYSSTATEMENTS                                                                                                                   |STMTID                                                                                                                          |1          |CHAR(36) NOT N&
@@ -260,7 +260,7 @@
 SYSTRIGGERS                                                                                                                     |TYPE                                                                                                                            |7          |CHAR(1) NOT NU&
 SYSTRIGGERS                                                                                                                     |WHENSTMTID                                                                                                                      |10         |CHAR(36)       
 SYSVIEWS                                                                                                                        |CHECKOPTION                                                                                                                     |3          |CHAR(1) NOT NU&
-SYSVIEWS                                                                                                                        |COMPILATIONSCHEMAID                                                                                                             |4          |CHAR(36) NOT N&
+SYSVIEWS                                                                                                                        |COMPILATIONSCHEMAID                                                                                                             |4          |CHAR(36)       
 SYSVIEWS                                                                                                                        |TABLEID                                                                                                                         |1          |CHAR(36) NOT N&
 SYSVIEWS                                                                                                                        |VIEWDEFINITION                                                                                                                  |2          |LONG VARCHAR N&
 ij> select TABLENAME, ISINDEX 
@@ -426,7 +426,7 @@
 SYSSCHEMAS                                                                                                                      |AUTHORIZATIONID                                                                                                                 |3          |VARCHAR(128) N&
 SYSSCHEMAS                                                                                                                      |SCHEMAID                                                                                                                        |1          |CHAR(36) NOT N&
 SYSSCHEMAS                                                                                                                      |SCHEMANAME                                                                                                                      |2          |VARCHAR(128) N&
-SYSSTATEMENTS                                                                                                                   |COMPILATIONSCHEMAID                                                                                                             |8          |CHAR(36) NOT N&
+SYSSTATEMENTS                                                                                                                   |COMPILATIONSCHEMAID                                                                                                             |8          |CHAR(36)       
 SYSSTATEMENTS                                                                                                                   |LASTCOMPILED                                                                                                                    |7          |TIMESTAMP      
 SYSSTATEMENTS                                                                                                                   |SCHEMAID                                                                                                                        |3          |CHAR(36) NOT N&
 SYSSTATEMENTS                                                                                                                   |STMTID                                                                                                                          |1          |CHAR(36) NOT N&
@@ -476,7 +476,7 @@
 SYSTRIGGERS                                                                                                                     |TYPE                                                                                                                            |7          |CHAR(1) NOT NU&
 SYSTRIGGERS                                                                                                                     |WHENSTMTID                                                                                                                      |10         |CHAR(36)       
 SYSVIEWS                                                                                                                        |CHECKOPTION                                                                                                                     |3          |CHAR(1) NOT NU&
-SYSVIEWS                                                                                                                        |COMPILATIONSCHEMAID                                                                                                             |4          |CHAR(36) NOT N&
+SYSVIEWS                                                                                                                        |COMPILATIONSCHEMAID                                                                                                             |4          |CHAR(36)       
 SYSVIEWS                                                                                                                        |TABLEID                                                                                                                         |1          |CHAR(36) NOT N&
 SYSVIEWS                                                                                                                        |VIEWDEFINITION                                                                                                                  |2          |LONG VARCHAR N&
 T                                                                                                                               |I                                                                                                                               |1          |INTEGER        

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out Sun Oct 15 08:35:27 2006
@@ -1263,4 +1263,44 @@
 C321       
 -----------
 1          
-ij> 
+ij> -- DERBY-630 
+-- NPE in CREATE TRIGGER when compilation schema is other than APP.
+connect 'jdbc:derby:wombat;create=true;user=user1;password=pwd' as user1;
+WARNING 01J01: Database 'wombat' not created, connection made to existing database instead.
+ij(USER1)> create table ippo.t1 (i int);
+0 rows inserted/updated/deleted
+ij(USER1)> create table ippo.t2 (i int);
+0 rows inserted/updated/deleted
+ij(USER1)> create index ippo.idx2 on t2(i);
+0 rows inserted/updated/deleted
+ij(USER1)> create trigger ippo.tr1 after insert on ippo.t1 for each row mode db2sql 
+   insert into ippo.t2 values 1;
+0 rows inserted/updated/deleted
+ij(USER1)> insert into ippo.t1 values 1;
+1 row inserted/updated/deleted
+ij(USER1)> insert into ippo.t1 values 1;
+1 row inserted/updated/deleted
+ij(USER1)> select * from ippo.t2;
+I          
+-----------
+1          
+1          
+ij(USER1)> drop index ippo.idx2;
+0 rows inserted/updated/deleted
+ij(USER1)> insert into ippo.t1 values 1;
+1 row inserted/updated/deleted
+ij(USER1)> select * from ippo.t2;
+I          
+-----------
+1          
+1          
+1          
+ij(USER1)> drop trigger ippo.tr1;
+0 rows inserted/updated/deleted
+ij(USER1)> drop table ippo.t2;
+0 rows inserted/updated/deleted
+ij(USER1)> drop table ippo.t1;
+0 rows inserted/updated/deleted
+ij(USER1)> drop schema ippo restrict;
+0 rows inserted/updated/deleted
+ij(USER1)> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.properties?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.properties Sun Oct 15 08:35:27 2006
@@ -1,4 +1,4 @@
-# the upgrade test Upgrade_10_1_10_2.java cannot be run with the following jvms:
+# the upgrade test Upgrade_10_1_10_3.java cannot be run with the following jvms:
 # jdk131, ibm131: missing support for obtaining version numbers
 # wctme5.7_foundation: missing support for java.sql.Driver
 # wsdd5.6, wctme5.7: missing support for javax.naming.InitialContext

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.runall?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/upgrade.runall Sun Oct 15 08:35:27 2006
@@ -1 +1 @@
-
+upgradeTests/Upgrade_10_1_10_3.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql Sun Oct 15 08:35:27 2006
@@ -709,3 +709,23 @@
 insert into t31TriggerTest values(1);
 select * from t31TriggerTest;
 select * from t32TriggerTest;
+
+
+-- DERBY-630 
+-- NPE in CREATE TRIGGER when compilation schema is other than APP.
+connect 'jdbc:derby:wombat;create=true;user=user1;password=pwd' as user1;
+create table ippo.t1 (i int);
+create table ippo.t2 (i int);
+create index ippo.idx2 on t2(i);
+create trigger ippo.tr1 after insert on ippo.t1 for each row mode db2sql 
+   insert into ippo.t2 values 1;
+insert into ippo.t1 values 1;
+insert into ippo.t1 values 1;
+select * from ippo.t2;
+drop index ippo.idx2;
+insert into ippo.t1 values 1;
+select * from ippo.t2;
+drop trigger ippo.tr1;
+drop table ippo.t2;
+drop table ippo.t1;
+drop schema ippo restrict;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java Sun Oct 15 08:35:27 2006
@@ -28,6 +28,7 @@
 import java.io.File;
 
 import java.sql.Connection;
+import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.sql.PreparedStatement;
@@ -365,6 +366,7 @@
 									oldMinorVersion) && passed;
             passed = caseTriggerVTI(conn, phase, oldMajorVersion, 
                     oldMinorVersion) && passed;
+			passed = caseCompilationSchema(phase, conn) && passed;
             passed = caseGrantRevoke(conn, phase, classLoader, false) && passed;
             // Test grant/revoke feature with sql authorization
             if(phase == PH_HARD_UPGRADE) {
@@ -373,7 +375,7 @@
             	passed = caseGrantRevoke(conn, phase, classLoader, true) && passed;
             	checkSysSchemas(conn);
             	checkRoutinePermissions(conn);
-            }        	
+            }        
 			runMetadataTest(classLoader, conn);
 			conn.close();
 			shutdownDatabase(classLoader);
@@ -502,7 +504,58 @@
 		System.out.println("complete caseVersionCheck - passed " + passed);
 		return passed;
 	}
-	
+
+	/**
+	 * Verify the compilation schema is nullable after upgrade
+	 * @param phase upgrade test phase
+	 * @param conn Connection
+	 * @throws SQLException
+	 */
+	private boolean caseCompilationSchema(int phase, Connection conn) 
+														throws SQLException
+	{
+		boolean passed = false;
+		DatabaseMetaData dmd;
+		ResultSet rs;
+		String isNullable;
+
+		if (conn == null)
+			return false;
+
+		dmd = conn.getMetaData();
+		
+		switch (phase)
+		{
+			case PH_CREATE:
+			case PH_POST_SOFT_UPGRADE:
+			case PH_POST_HARD_UPGRADE:
+				passed = true;
+				break;
+
+			case PH_SOFT_UPGRADE:
+			case PH_HARD_UPGRADE:
+				rs = dmd.getColumns(null, "SYS", "SYSSTATEMENTS", "COMPILATIONSCHEMAID");
+				rs.next();
+				isNullable = rs.getString("IS_NULLABLE");
+				System.out.println ("SYS.SYSSTATEMENTS.COMPILATIONSCHEMAID IS_NULLABLE=" + isNullable);
+				passed = ("YES".equals(isNullable));
+
+				rs = dmd.getColumns(null, "SYS", "SYSVIEWS", "COMPILATIONSCHEMAID");
+				rs.next();
+				isNullable = rs.getString("IS_NULLABLE");
+				System.out.println("SYS.SYSVIEWS.COMPILATIONSCHEMAID IS_NULLABLE=" + isNullable);
+				passed = ("YES".equals(isNullable)) && passed;
+				break;
+			
+			default:
+				passed = false;
+				break;
+		}
+
+		System.out.println("complete caseCompilationSchema - passed " + passed);
+		return passed;
+	}
+
 	/**
 	 * In 10.2: We will write a ReusableRecordIdSequenceNumber in the 
 	 * header of a FileContaienr.

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3.java?view=auto&rev=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3.java Sun Oct 15 08:35:27 2006
@@ -0,0 +1,56 @@
+/*
+
+Derby - org.apache.derbyTesting.functionTests.tests.upgradeTests.Upgrade_10_1_10_3
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import java.net.MalformedURLException;
+import java.sql.SQLException;
+
+/**
+ * Test upgrade from 10.1 to 10.3 
+ */
+public class Upgrade_10_1_10_3 {
+
+	public static void main(String[] args) {
+		
+		int oldMajorVersion = 10;
+		int oldMinorVersion = 1;
+		int newMajorVersion = 10;
+		int newMinorVersion = 3;
+		boolean allowPreReleaseUpgrade = true;
+		
+		try {
+			UpgradeTester upgradeTester = new UpgradeTester(
+											oldMajorVersion, oldMinorVersion,
+											newMajorVersion, newMinorVersion,
+											allowPreReleaseUpgrade);
+			upgradeTester.runUpgradeTests();
+		} catch(MalformedURLException mue) {
+			System.out.println("MalformedURLException: " + mue.getMessage());
+			mue.printStackTrace();
+		} catch (SQLException sqle) {
+			System.out.println("SQLException:");
+			UpgradeTester.dumpSQLExceptions(sqle);
+		} catch (Exception e) {
+			System.out.println("Exception: " + e.getMessage());
+			e.printStackTrace();
+		}
+	}
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3_sed.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3_sed.properties?view=auto&rev=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3_sed.properties (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3_sed.properties Sun Oct 15 08:35:27 2006
@@ -0,0 +1,10 @@
+# Filters and substitutes for SED
+# Multiple patterns for DELETE: comma separated
+#   delete=pattern1,pattern2,...,patternn
+# No commas can be allowed in the patterns.
+#
+# Multiple patterns for SUBSTITUTE: comma separated <pattern;substitute> pair
+#   substitute=pattern1;substitute1,pattern2;substitute2,...,patternn;substituten
+# No commas or semicolons can be allowed in the patterns/subsitutes.
+delete=JDBC Driver*,getDatabaseProductVersion()*,getDriverVersion()*
+

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Upgrade_10_1_10_3_sed.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/build.xml?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/build.xml Sun Oct 15 08:35:27 2006
@@ -95,7 +95,7 @@
   </target> 
 	
   <target name="checkUpgradeAppProps">		
-  	<available file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_2_app.properties" property="haveUpgradeProps"/>
+  	<available file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_3_app.properties" property="haveUpgradeProps"/>
   </target>
  
   <target name="updateProperty" unless="haveUpgradeProps">
@@ -104,7 +104,7 @@
   </target>
 	
   <target name="setpropertydefault" unless="derbyTesting.jar.path">
-  	<propertyfile file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_2_app.properties"
+  	<propertyfile file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_3_app.properties"
                       comment="Need to find out the set of permissions required by upgrade test - DERBY-1135">
 		<entry key="jvmflags" value="-DderbyTesting.jar.path=${src.dir}/tools/testing/derby"/>
 		<entry key="noSecurityManager" value="true"/>
@@ -112,7 +112,7 @@
   </target>
 	
   <target name="setproperty" if="derbyTesting.jar.path">
-  	<propertyfile file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_2_app.properties"
+  	<propertyfile file="${out.dir}/${derby.testing.functest.dir}/tests/upgradeTests/Upgrade_10_1_10_3_app.properties"
                       comment="Need to find out the set of permissions required by upgrade test - DERBY-1135">
   		<entry key="jvmflags" value="-DderbyTesting.jar.path=${derbyTesting.jar.path}" />
 		<entry key="noSecurityManager" value="true"/>

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/copyfiles.ant
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/copyfiles.ant?view=diff&rev=464215&r1=464214&r2=464215
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/copyfiles.ant (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/copyfiles.ant Sun Oct 15 08:35:27 2006
@@ -1,3 +1,3 @@
-Upgrade_10_1_10_2_app.properties
-Upgrade_10_1_10_2_sed.properties
+Upgrade_10_1_10_3_app.properties
+Upgrade_10_1_10_3_sed.properties