db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r428872 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/catalog/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/
Date Fri, 04 Aug 2006 20:29:29 GMT
Author: djd
Date: Fri Aug  4 13:29:29 2006
New Revision: 428872

URL: http://svn.apache.org/viewvc?rev=428872&view=rev
Log:
DERBY-1544 (partial) Upgrading a database from 10.1 to 10.2 should automatically change database
owner,
recorded as owner of system schemas in sysschemas, from pseudo user 'DBA' to authorizationID
of the user
attempting upgrade. This was being done in DataDictionaryImpl.updateSchemaAuth method.
I think a wrong index was being used in the call to updateRow. Also the SCHEMAAID column which
we are changing
is not part of any index in SYSSCHEMAS. So there is no need to update any index. 
Patch contributed by Deepa Remesh

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_2.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeTester.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=428872&r1=428871&r2=428872&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Fri Aug  4 13:29:29 2006
@@ -5607,12 +5607,12 @@
 		row.setColumn(SYSSCHEMASRowFactory.SYSSCHEMAS_SCHEMAAID,
 					  dvf.getVarcharDataValue(authorizationId));
 
-		boolean[] bArray = {false, true};
+		boolean[] bArray = {false, false};
 
 		int[] colsToUpdate = {SYSSCHEMASRowFactory.SYSSCHEMAS_SCHEMAAID};
 
 		ti.updateRow(keyRow, row,
-					 SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX2_ID,
+					 SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX1_ID,
 					 bArray,
 					 colsToUpdate,
 					 tc);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_2.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_2.out?rev=428872&r1=428871&r2=428872&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_2.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/Upgrade_10_1_10_2.out
Fri Aug  4 13:29:29 2006
@@ -2186,6 +2186,19 @@
 Expected exception during shutdown: Database 'wombat' shutdown.
 Test grant/revoke, Phase: UPGRADE; derby.database.sqlAuthorization=true
 complete caseGrantRevoke - passed true
+Checking SYSSCHEMAS
+SCHEMANAME: SYSIBM , AUTHORIZATIONID: APP
+SCHEMANAME: SYS , AUTHORIZATIONID: APP
+SCHEMANAME: SYSCAT , AUTHORIZATIONID: APP
+SCHEMANAME: SYSFUN , AUTHORIZATIONID: APP
+SCHEMANAME: SYSPROC , AUTHORIZATIONID: APP
+SCHEMANAME: SYSSTAT , AUTHORIZATIONID: APP
+SCHEMANAME: NULLID , AUTHORIZATIONID: APP
+SCHEMANAME: SQLJ , AUTHORIZATIONID: APP
+SCHEMANAME: SYSCS_DIAG , AUTHORIZATIONID: APP
+SCHEMANAME: SYSCS_UTIL , AUTHORIZATIONID: APP
+SCHEMANAME: APP , AUTHORIZATIONID: APP
+SCHEMANAME: D438 , AUTHORIZATIONID: APP
 Test metadata starting
 Union Result -- precision: 10 scale: 2 display size: 13 type name: DECIMAL
 dec(10,2) -- precision: 10 scale: 2 display size: 12 type name: DECIMAL

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?rev=428872&r1=428871&r2=428872&view=diff
==============================================================================
--- 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
Fri Aug  4 13:29:29 2006
@@ -370,6 +370,7 @@
             	setSQLAuthorization(conn, true);
             	conn = restartDatabase(classLoader);
             	passed = caseGrantRevoke(conn, phase, classLoader, true) && passed;
+            	checkSysSchemas(conn);
             }        	
 			runMetadataTest(classLoader, conn);
 			conn.close();
@@ -940,6 +941,29 @@
     	} catch (SQLException sqle) {
     		dumpSQLExceptions(sqle);
     	}
+    }
+    
+    /**
+     * This method lists the schema names and authorization ids in 
+     * SYS.SCHEMAS table. This is to test that the owner of system schemas is 
+     * changed from pseudo user "DBA" to the user invoking upgrade. 
+     * 
+     * @param conn
+     * @throws SQLException
+     */
+    private void checkSysSchemas(Connection conn) throws SQLException{
+    	System.out.println("Checking SYSSCHEMAS");
+    	
+    	Statement s = conn.createStatement();
+    	ResultSet rs = s.executeQuery("select * from SYS.SYSSCHEMAS");
+    	
+    	while(rs.next()) {
+    		System.out.println("SCHEMANAME: " + rs.getString(2) + " , " 
+    						+ "AUTHORIZATIONID: " + rs.getString(3));
+    	}
+    	
+    	rs.close();
+    	s.close();
     }
     
     /**



Mime
View raw message