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 ba...@apache.org on 2006/05/26 09:46:46 UTC

svn commit: r409580 - in /db/derby/code/branches/10.0/java: engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/f...

Author: bandaram
Date: Fri May 26 00:46:45 2006
New Revision: 409580

URL: http://svn.apache.org/viewvc?rev=409580&view=rev
Log:
DERBY-655: Generate unique logical conglomerateId for duplicate indexes, instead of just reusing existing conglomerateId.

Submitted by Mamta A. Satoor(msatoor@gmail.com)

Modified:
    db/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
    db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
    db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
    db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata.java

Modified: db/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java?rev=409580&r1=409579&r2=409580&view=diff
==============================================================================
--- db/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java (original)
+++ db/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java Fri May 26 00:46:45 2006
@@ -353,9 +353,12 @@
 					return;
 				}
 
+				//Duplicate indexes share the physical conglomerate underneath
 				conglomId = cd.getConglomerateNumber();
 				indexRowGenerator = cd.getIndexDescriptor();
-				conglomerateUUID = cd.getUUID();
+				//DERBY-655 and DERBY-1343  
+				//Duplicate indexes will have unqiue logical conglomerate UUIDs.  
+				conglomerateUUID = dd.getUUIDFactory().createUUID();
 				duplicate = true;
 				break;
 			}

Modified: db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out?rev=409580&r1=409579&r2=409580&view=diff
==============================================================================
--- db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out (original)
+++ db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out Fri May 26 00:46:45 2006
@@ -468,4 +468,7 @@
 defval for col C5 type CHAR DEFAULT 'NULL' wasnull false
 defval for col C6 type CHAR DEFAULT ''NULL'' wasnull false
 defval for col C7 type INTEGER DEFAULT '88' wasnull false
+getImportedKeys('',null,null,'','APP','Derby655t1' ):
+PKTABLE_CAT,PKTABLE_SCHEM,PKTABLE_NAME,PKCOLUMN_NAME,FKTABLE_CAT,FKTABLE_SCHEM,FKTABLE_NAME,FKCOLUMN_NAME,KEY_SEQ,UPDATE_RULE,DELETE_RULE,FK_NAME,PK_NAME,DEFERRABILITY
+,APP,DERBY655T2,C21_ID,,APP,DERBY655T1,C11_ID,1,3,0,F_12,xxxxGENERATED-IDxxxx,7
 Test metadata finished

Modified: db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out?rev=409580&r1=409579&r2=409580&view=diff
==============================================================================
--- db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out (original)
+++ db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out Fri May 26 00:46:45 2006
@@ -468,4 +468,7 @@
 defval for col C5 type CHAR DEFAULT 'NULL' wasnull false
 defval for col C6 type CHAR DEFAULT ''NULL'' wasnull false
 defval for col C7 type INTEGER DEFAULT '88' wasnull false
+getImportedKeys('',null,null,'','APP','Derby655t1' ):
+PKTABLE_CAT,PKTABLE_SCHEM,PKTABLE_NAME,PKCOLUMN_NAME,FKTABLE_CAT,FKTABLE_SCHEM,FKTABLE_NAME,FKCOLUMN_NAME,KEY_SEQ,UPDATE_RULE,DELETE_RULE,FK_NAME,PK_NAME,DEFERRABILITY
+,APP,DERBY655T2,C21_ID,,APP,DERBY655T1,C11_ID,1,3,0,F_12,xxxxGENERATED-IDxxxx,7
 Test metadata finished

Modified: db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata.java?rev=409580&r1=409579&r2=409580&view=diff
==============================================================================
--- db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata.java (original)
+++ db/derby/code/branches/10.0/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata.java Fri May 26 00:46:45 2006
@@ -781,6 +781,24 @@
 			}
 			s.execute("drop table t1");
 
+			// test DERBY-655, DERBY-1343
+			// If a table has duplicate backing index, then it will share the 
+			// physical conglomerate with the existing index, but the duplicate
+			// indexes should have their own unique logical congomerates 
+			// associated with them. That way, it will be possible to 
+			// distinguish the 2 indexes in SYSCONGLOMERATES from each other.
+			s.execute("CREATE TABLE Derby655t1(c11_ID BIGINT NOT NULL)");
+			s.execute("CREATE TABLE Derby655t2 (c21_ID BIGINT NOT NULL primary key)");
+			s.execute("ALTER TABLE Derby655t1 ADD CONSTRAINT F_12 Foreign Key (c11_ID) REFERENCES Derby655t2 (c21_ID) ON DELETE CASCADE ON UPDATE NO ACTION");
+			s.execute("CREATE TABLE Derby655t3(c31_ID BIGINT NOT NULL primary key)");
+			s.execute("ALTER TABLE Derby655t2 ADD CONSTRAINT F_443 Foreign Key (c21_ID) REFERENCES Derby655t3(c31_ID) ON DELETE CASCADE ON UPDATE NO ACTION");
+			dmd = con.getMetaData();
+			System.out.println("\ngetImportedKeys('',null,null,'','APP','Derby655t1' ):");
+			dumpRS(met.getImportedKeys("", "APP", "DERBY655T1"));
+			s.execute("drop table Derby655t1");
+			s.execute("drop table Derby655t2");
+			s.execute("drop table Derby655t3");
+
 			// tiny test moved over from no longer used metadata2.sql
 			// This checks for a bug where you get incorrect behavior on a nested connection.
 			// if you do not get an error, the bug does not occur.