db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r491632 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Mon, 01 Jan 2007 21:10:21 GMT
Author: bpendleton
Date: Mon Jan  1 13:10:20 2007
New Revision: 491632

URL: http://svn.apache.org/viewvc?view=rev&rev=491632
Log:
DERBY-2202: DROP PROCEDURE depends on SET SCHEMA

This patch was contributed by Yip Ng (yipng168@gmail.com)

The symptom of this jira is the same as those described in DERBY-1304
for DROP VIEW except that it applies to DROP PROCEDURE, DROP FUNCTION
and DROP SYNONYM statements. (Their bind logic are centralized in
DropAliasNode.) The DropAliasNode's bindStatement() should have created
a dependency on the statement, so when its associated alias descriptor
gets dropped, the statement can be invalidated accordingly. This explains
why subsequent DROP PROCEDURE statement fails.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/depend.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/depend.sql

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java?view=diff&rev=491632&r1=491631&r2=491632
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropAliasNode.java Mon
Jan  1 13:10:20 2007
@@ -124,6 +124,8 @@
 			throw StandardException.newException(SQLState.LANG_CANNOT_DROP_SYSTEM_ALIASES, aliasName);
 		}
 
+		// Statement is dependent on the AliasDescriptor
+		getCompilerContext().createDependency(ad);
 	}
 
 	// inherit generate() method from DDLStatementNode

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/depend.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/depend.out?view=diff&rev=491632&r1=491631&r2=491632
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/depend.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/depend.out
Mon Jan  1 13:10:20 2007
@@ -242,4 +242,110 @@
 4          |4          
 ij> -- cleanup, roll everything back to the beginning
 rollback;
+ij> -- DERBY-2202
+-- test various DROP statements
+
+-- test procedure
+autocommit off;
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+0 rows inserted/updated/deleted
+ij> DROP PROCEDURE datamgmt.exit;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+0 rows inserted/updated/deleted
+ij> DROP PROCEDURE datamgmt.exit;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> autocommit on;
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+0 rows inserted/updated/deleted
+ij> DROP PROCEDURE datamgmt.exit;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+0 rows inserted/updated/deleted
+ij> DROP PROCEDURE datamgmt.exit;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> -- test function
+CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE FUNCTION datamgmt.f_abs(P1 INT)
+ RETURNS INT
+ NO SQL
+ RETURNS NULL ON NULL INPUT
+ EXTERNAL NAME 'java.lang.Math.abs'
+ LANGUAGE JAVA PARAMETER STYLE JAVA;
+0 rows inserted/updated/deleted
+ij> DROP FUNCTION datamgmt.f_abs;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE FUNCTION datamgmt.f_abs(P1 INT)
+ RETURNS INT
+ NO SQL
+ RETURNS NULL ON NULL INPUT
+ EXTERNAL NAME 'java.lang.Math.abs'
+ LANGUAGE JAVA PARAMETER STYLE JAVA;
+0 rows inserted/updated/deleted
+ij> DROP FUNCTION datamgmt.f_abs;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> -- test synonym
+CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE TABLE datamgmt.t1 (c1 int);
+0 rows inserted/updated/deleted
+ij> CREATE SYNONYM datamgmt.s1 for datamgmt.t1;
+0 rows inserted/updated/deleted
+ij> DROP SYNONYM datamgmt.s1;
+0 rows inserted/updated/deleted
+ij> DROP TABLE datamgmt.t1;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
+ij> CREATE SCHEMA datamgmt;
+0 rows inserted/updated/deleted
+ij> CREATE TABLE datamgmt.t1 (c1 int);
+0 rows inserted/updated/deleted
+ij> CREATE SYNONYM datamgmt.s1 for datamgmt.t1;
+0 rows inserted/updated/deleted
+ij> DROP SYNONYM datamgmt.s1;
+0 rows inserted/updated/deleted
+ij> DROP TABLE datamgmt.t1;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA datamgmt RESTRICT;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out?view=diff&rev=491632&r1=491631&r2=491632
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
Mon Jan  1 13:10:20 2007
@@ -2213,7 +2213,7 @@
 ij(MAMTA1)> grant select on t12RoutineTest to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> drop function selectFromSpecificSchema;
-ERROR: Failed with SQLSTATE 42X94
+ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA1)> CREATE FUNCTION selectFromSpecificSchema (P1 INT)
         RETURNS INT 
         RETURNS NULL ON NULL INPUT

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/depend.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/depend.sql?view=diff&rev=491632&r1=491631&r2=491632
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/depend.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/depend.sql
Mon Jan  1 13:10:20 2007
@@ -158,3 +158,80 @@
 
 -- cleanup, roll everything back to the beginning
 rollback;
+
+-- DERBY-2202
+-- test various DROP statements
+
+-- test procedure
+autocommit off;
+CREATE SCHEMA datamgmt;
+CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+DROP PROCEDURE datamgmt.exit;
+DROP SCHEMA datamgmt RESTRICT;
+CREATE SCHEMA datamgmt;
+CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+DROP PROCEDURE datamgmt.exit;
+DROP SCHEMA datamgmt RESTRICT;
+
+autocommit on;
+CREATE SCHEMA datamgmt;
+CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+DROP PROCEDURE datamgmt.exit;
+DROP SCHEMA datamgmt RESTRICT;
+
+CREATE SCHEMA datamgmt;
+CREATE PROCEDURE datamgmt.exit ( IN value INTEGER )
+ MODIFIES SQL DATA
+ PARAMETER STYLE JAVA
+ LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.System.exit';
+DROP PROCEDURE datamgmt.exit;
+DROP SCHEMA datamgmt RESTRICT;
+
+-- test function
+CREATE SCHEMA datamgmt;
+CREATE FUNCTION datamgmt.f_abs(P1 INT)
+ RETURNS INT
+ NO SQL
+ RETURNS NULL ON NULL INPUT
+ EXTERNAL NAME 'java.lang.Math.abs'
+ LANGUAGE JAVA PARAMETER STYLE JAVA;
+DROP FUNCTION datamgmt.f_abs;
+DROP SCHEMA datamgmt RESTRICT;
+
+CREATE SCHEMA datamgmt;
+CREATE FUNCTION datamgmt.f_abs(P1 INT)
+ RETURNS INT
+ NO SQL
+ RETURNS NULL ON NULL INPUT
+ EXTERNAL NAME 'java.lang.Math.abs'
+ LANGUAGE JAVA PARAMETER STYLE JAVA;
+DROP FUNCTION datamgmt.f_abs;
+DROP SCHEMA datamgmt RESTRICT;
+
+-- test synonym
+CREATE SCHEMA datamgmt;
+CREATE TABLE datamgmt.t1 (c1 int);
+CREATE SYNONYM datamgmt.s1 for datamgmt.t1;
+DROP SYNONYM datamgmt.s1;
+DROP TABLE datamgmt.t1;
+DROP SCHEMA datamgmt RESTRICT;
+
+CREATE SCHEMA datamgmt;
+CREATE TABLE datamgmt.t1 (c1 int);
+CREATE SYNONYM datamgmt.s1 for datamgmt.t1;
+DROP SYNONYM datamgmt.s1;
+DROP TABLE datamgmt.t1;
+DROP SCHEMA datamgmt RESTRICT;
\ No newline at end of file



Mime
View raw message