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 km...@apache.org on 2011/06/06 21:59:33 UTC
svn commit: r1132738 - in /db/derby/code/branches/10.8: ./
java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Author: kmarsden
Date: Mon Jun 6 19:59:32 2011
New Revision: 1132738
URL: http://svn.apache.org/viewvc?rev=1132738&view=rev
Log:
DERBY-5249 A table created with 10.0.2.1 with constraints cannot be dropped with 10.5 due to NullPointerException with insane build or ASSERT FAILED Failed to find sharable conglomerate descriptor for index conglomerate
merge 1130632 and 1131272 from trunk.
Modified:
db/derby/code/branches/10.8/ (props changed)
db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 6 19:59:32 2011
@@ -1,2 +1,2 @@
/db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101839,1102826,1103681,1103718,1125305,1126358,1127825,1127883,1129136,1129764,1129797,1130895,1132546
+/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101839,1102826,1103681,1103718,1125305,1126358,1127825,1127883,1129136,1129764,1129797,1130632,1130895,1131272,1132546
Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java?rev=1132738&r1=1132737&r2=1132738&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptor.java Mon Jun 6 19:59:32 2011
@@ -598,8 +598,15 @@ public final class ConglomerateDescripto
}
// Skip if ignoreThis is true and it describes "this".
+ // DERBY-5249. We need to check both the UUID and the
+ // conglomerateName to see if this is a match, because
+ // databases prior to the DERBY-655 fix may have a
+ // duplicate conglomerateID
if (ignoreThis &&
- getUUID().equals(descriptors[i].getUUID()))
+ getUUID().equals(descriptors[i].getUUID()) &&
+ getConglomerateName().equals(descriptors[i].
+ getConglomerateName())
+ )
{
continue;
}
Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java?rev=1132738&r1=1132737&r2=1132738&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java Mon Jun 6 19:59:32 2011
@@ -1,6 +1,6 @@
/*
-Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.BasicSetup
+Derby - Class org.apache.dertbyTesting.functionTests.tests.upgradeTests.BasicSetup
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -266,6 +266,60 @@ public class BasicSetup extends UpgradeC
}
break;
}
+ }
+
+
+ /**
+ * DERBY-5249 table created with primary and foreign key can't be dropped
+ * Test currently disabled. Remove the x from the name to enable the
+ * test once the bug is fixed.
+ *
+ */
+ public void testDropTableAfterUpgradeWithConstraint() throws SQLException {
+ final int phase = getPhase();
+
+ Statement s = createStatement();
+
+ switch (phase) {
+ case PH_CREATE:
+ s.executeUpdate("CREATE SCHEMA S");
+ s.executeUpdate("CREATE TABLE S.RS (R_TYPE_ID VARCHAR(64) "
+ + "NOT NULL)");
+ s.executeUpdate("ALTER TABLE S.RS ADD CONSTRAINT PK_RS "
+ + "PRIMARY KEY (R_TYPE_ID)");
+ s.executeUpdate("CREATE TABLE S.R_TYPE_ID (R_TYPE_ID "
+ + "VARCHAR(64) NOT NULL)");
+ s.executeUpdate("ALTER TABLE S.R_TYPE_ID ADD CONSTRAINT "
+ + "PK_R_TYPE_ID PRIMARY KEY (R_TYPE_ID)");
+ s.executeUpdate("ALTER TABLE S.RS ADD CONSTRAINT "
+ + "FK_RS_TYPEID FOREIGN KEY (R_TYPE_ID) REFERENCES "
+ + "S.R_TYPE_ID (R_TYPE_ID) ON DELETE CASCADE ON "
+ + "UPDATE NO ACTION");
+ /*
+ * With 10.0 and early 10.1 releases a duplicate conglomerate entry
+ * shows in sys.sysconglomerates for the primary key PK_RS. It can
+ * be seen with this query.
+
+ Utilities.showResultSet(s.executeQuery(
+ "select c.constraintname, c.constraintid, cong.conglomerateid, cong.conglomeratename from sys.sysconglomerates cong, sys.syskeys k, sys.sysconstraints c where c.constraintname = 'PK_RS' and c.constraintid =k.constraintid and k.conglomerateid = cong.conglomerateid "
+ ));
+ */
+ break;
+ case PH_SOFT_UPGRADE:
+ s.executeUpdate("ALTER TABLE S.RS DROP CONSTRAINT FK_RS_TYPEID");
+ s.executeUpdate("ALTER TABLE S.R_TYPE_ID DROP CONSTRAINT "
+ + "PK_R_TYPE_ID");
+ s.executeUpdate("ALTER TABLE S.RS DROP CONSTRAINT PK_RS");
+ s.executeUpdate("DROP TABLE S.RS");
+ s.executeUpdate("DROP TABLE S.R_TYPE_ID");
+ s.executeUpdate("DROP SCHEMA S RESTRICT");
+ break;
+ case PH_POST_SOFT_UPGRADE:
+ break;
+ case PH_HARD_UPGRADE:
+ break;
+ }
+
}
final int TEST_COUNT = 0;
final int FAILURES = TEST_COUNT + 1;