db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r1572994 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derbyTesting/functionTests/tests/tools/ java/tools/org/apache/derby/impl/tools/dblook/
Date Fri, 28 Feb 2014 16:41:50 GMT
Author: mikem
Date: Fri Feb 28 16:41:50 2014
New Revision: 1572994

URL: http://svn.apache.org/r1572994
Log:
DERBY-6387: Incorrect ordering of triggers in dblook

backported change #1551940.  backport required some manual merge as the
key query had changed in multiple ways on the trunk.  Fix was to just add
the "order by" by hand to the existing 10.10 query.

Order the triggers by the CREATIONTIMESTAMP column so that dblook
produces a script that recreates the triggers in the same order as
they were originally created.


Added:
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB_derby6387.sql
      - copied unchanged from r1551940, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB_derby6387.sql
Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_app.properties
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
    db/derby/code/branches/10.10/java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Reverse-merged /db/derby/code/trunk:r1530517,1530913,1534465,1560311
  Merged /db/derby/code/trunk:r1551940

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
Fri Feb 28 16:41:50 2014
@@ -6238,4 +6238,41 @@ File dblook.log was NOT empty.  Contents
 -- **--> DEBUG: Failed to load jar file <jarFilePath>
 java.io.FileNotFoundException: <filePath>
 ############## End File Contents ################
+-= Start DERBY-6387 test. =-
+Database 'wombat' deleted.
+Creating database 'wombat' from ddl script 'dblook_makeDB_derby6387.sql'
+--
+*******************************************
+Dumping full schema for 'wombat'
+to file 'wombat.sql':
+*******************************************
+File dblook.log was empty.
+File wombat.sql was NOT empty.  Contents are:
+############## Begin File Contents ################
+-- ============================
+-- This file was created using Derby's dblook utility.
+-- Timestamp: xxxxxxFILTERED-TIMESTAMPxxxxx
+-- Source database is: <dbPath>
+-- Connection URL is: <dbURL>
+-- appendLogs: false
+-- ----------------------------------------------
+-- DDL Statements for tables
+-- ----------------------------------------------
+CREATE TABLE "APP"."T1" ("X" INTEGER)
+-- ----------------------------------------------
+-- DDL Statements for triggers
+-- ----------------------------------------------
+CREATE TRIGGER "APP"."TR13" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR14" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR15" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR16" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR17" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR18" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR19" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR20" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR21" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR22" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR23" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR24" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+############## End File Contents ################
 [ Done. ]

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
Fri Feb 28 16:41:50 2014
@@ -6238,4 +6238,41 @@ File dblook.log was NOT empty.  Contents
 -- **--> DEBUG: Failed to load jar file <jarFilePath>
 java.io.FileNotFoundException: <filePath>
 ############## End File Contents ################
+-= Start DERBY-6387 test. =-
+Database 'wombat' deleted.
+Creating database 'wombat' from ddl script 'dblook_makeDB_derby6387.sql'
+--
+*******************************************
+Dumping full schema for 'wombat'
+to file 'wombat.sql':
+*******************************************
+File dblook.log was empty.
+File wombat.sql was NOT empty.  Contents are:
+############## Begin File Contents ################
+-- ============================
+-- This file was created using Derby's dblook utility.
+-- Timestamp: xxxxxxFILTERED-TIMESTAMPxxxxx
+-- Source database is: <dbPath>
+-- Connection URL is: <dbURL>
+-- appendLogs: false
+-- ----------------------------------------------
+-- DDL Statements for tables
+-- ----------------------------------------------
+CREATE TABLE "APP"."T1" ("X" INTEGER)
+-- ----------------------------------------------
+-- DDL Statements for triggers
+-- ----------------------------------------------
+CREATE TRIGGER "APP"."TR13" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR14" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR15" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR16" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR17" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR18" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR19" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR20" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR21" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR22" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR23" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+CREATE TRIGGER "APP"."TR24" AFTER UPDATE ON "APP"."T1" REFERENCING NEW_TABLE AS NEW FOR EACH
STATEMENT select * from sys.systables natural join sys.sysschemas where exists(select * from
new where x > 100)
+############## End File Contents ################
 [ Done. ]

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
Fri Feb 28 16:41:50 2014
@@ -105,6 +105,10 @@ public class dblook_test {
 			createTestDatabase(dbCreationScript_2);
 			runMessageCheckTest(testDBName);
 
+            // Test DERBY-6387 - wrong order of triggers
+            System.out.println("\n-= Start DERBY-6387 test. =-");
+            testDerby6387();
+
 		} catch (SQLException se) {
 
 			System.out.println("FAILED: to complete the test:");
@@ -1728,4 +1732,22 @@ public class dblook_test {
 
 	}
 
+    /**
+     * Regression test case for DERBY-6387. Verify that triggers are returned
+     * in the order in which they were created.
+     */
+    private void testDerby6387() throws Exception {
+        // Create the test database.
+        createTestDatabase("dblook_makeDB_derby6387.sql");
+
+        // Run dblook on it.
+        lookOne(testDBName);
+
+        // Check that the error log was empty.
+        dumpFileToSysOut("dblook.log");
+
+        // Check the dblook output. Before DERBY-6387 was fixed, TR24 was
+        // first in the output. It should be last.
+        dumpFileToSysOut(testDBName + ".sql");
+    }
 }

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_app.properties?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_app.properties
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_app.properties
Fri Feb 28 16:41:50 2014
@@ -14,7 +14,7 @@
 # limitations under the License.
 ij.user=app
 ij.password=apppw
-supportfiles=tests/tools/dblook_makeDB.sql,tests/tools/dblook_makeDB_2.sql,tests/tools/dblook_test.jar
+supportfiles=tests/tools/dblook_makeDB.sql,tests/tools/dblook_makeDB_2.sql,tests/tools/dblook_test.jar,tests/tools/dblook_makeDB_derby6387.sql
 
 #Exclude for J2ME/Foundation - test requires java.sql.DriverManager
 runwithfoundation=false

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
Fri Feb 28 16:41:50 2014
@@ -15,7 +15,7 @@
 
 ij.user=app
 ij.password=apppw
-supportfiles=tests/tools/dblook_makeDB.sql,tests/tools/dblook_makeDB_2.sql,tests/tools/dblook_test.jar
+supportfiles=tests/tools/dblook_makeDB.sql,tests/tools/dblook_makeDB_2.sql,tests/tools/dblook_test.jar,tests/tools/dblook_makeDB_derby6387.sql
 
 #Exclude for J2ME/Foundation - test requires java.sql.DriverManager
 runwithfoundation=false

Modified: db/derby/code/branches/10.10/java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java?rev=1572994&r1=1572993&r2=1572994&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java
(original)
+++ db/derby/code/branches/10.10/java/tools/org/apache/derby/impl/tools/dblook/DB_Trigger.java
Fri Feb 28 16:41:50 2014
@@ -50,7 +50,8 @@ public class DB_Trigger {
 		ResultSet rs = stmt.executeQuery("SELECT TRIGGERNAME, SCHEMAID, " +
 			"EVENT, FIRINGTIME, TYPE, TABLEID, REFERENCEDCOLUMNS, " + 
 			"TRIGGERDEFINITION, REFERENCINGOLD, REFERENCINGNEW, OLDREFERENCINGNAME, " +
-			"NEWREFERENCINGNAME FROM SYS.SYSTRIGGERS WHERE STATE != 'D'");
+			"NEWREFERENCINGNAME FROM SYS.SYSTRIGGERS WHERE STATE != 'D'" +
+            "ORDER BY CREATIONTIMESTAMP");
 
 		boolean firstTime = true;
 		while (rs.next()) {



Mime
View raw message