db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r675129 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 09 Jul 2008 09:54:06 GMT
Author: dag
Date: Wed Jul  9 02:54:06 2008
New Revision: 675129

URL: http://svn.apache.org/viewvc?rev=675129&view=rev
Log:
DERBY-3743 Revoking EXECUTE privilege on a function if used in a CHECK constraint: implementation
problem

Patch derby-3743, which changes the implementation and adds a test
case to verify that the change doesn't break the current behavior.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java?rev=675129&r1=675128&r2=675129&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConstraintDescriptor.java
Wed Jul  9 02:54:06 2008
@@ -557,6 +557,7 @@
 			//don't do anything here. Later in makeInvalid method, we make  
 			//the ConstraintDescriptor drop itself. 
 		    case DependencyManager.REVOKE_PRIVILEGE:
+		    case DependencyManager.INTERNAL_RECOMPILE_REQUEST:
 				break;
 
 			/*
@@ -634,7 +635,8 @@
 		if ((action != DependencyManager.SET_CONSTRAINTS_DISABLE) &&
 			(action != DependencyManager.SET_CONSTRAINTS_ENABLE) &&
 			(action != DependencyManager.SET_TRIGGERS_ENABLE) &&
-			(action != DependencyManager.SET_TRIGGERS_DISABLE)
+			(action != DependencyManager.SET_TRIGGERS_DISABLE) &&
+			(action != DependencyManager.INTERNAL_RECOMPILE_REQUEST)
 		   )
 		{
 			/* 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java?rev=675129&r1=675128&r2=675129&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
Wed Jul  9 02:54:06 2008
@@ -328,6 +328,8 @@
 								enabled
 								);
 				dd.addConstraintDescriptor(conDesc, tc);
+				storeConstraintDependenciesOnPrivileges
+					(activation, conDesc, null);
 				break;
 
 			case DataDictionary.FOREIGNKEY_CONSTRAINT:

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java?rev=675129&r1=675128&r2=675129&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
Wed Jul  9 02:54:06 2008
@@ -299,10 +299,9 @@
 						//privilege in the required privileges list
 						if (!statementTablePermission.getTableUUID().equals(refTableUUID))
 							continue;
-					} else if (statPerm instanceof StatementSchemaPermission 
-							|| statPerm instanceof StatementRoutinePermission)
+					} else if (statPerm instanceof StatementSchemaPermission) { 
 						continue;
-
+					}
 					//We know that we are working with a REFERENCES 
 					//privilege. Find all the PermissionDescriptors for
 					//this privilege and make constraint depend on it

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java?rev=675129&r1=675128&r2=675129&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeDDLTest.java
Wed Jul  9 02:54:06 2008
@@ -6064,7 +6064,23 @@
             " create table d1589t31ConstraintTest (c311 int, "
             + "c312 int, foreign key(c311, c312) references "
             + "mamta1.d1589t11ConstraintTest)");
-        
+
+        // DERBY-3743
+        st.executeUpdate(
+            "CREATE FUNCTION F_ABS(P1 INT) RETURNS INT NO "
+            + "SQL RETURNS NULL ON NULL INPUT EXTERNAL NAME "
+            + "'java.lang.Math.abs' LANGUAGE JAVA PARAMETER STYLE JAVA");
+        st.executeUpdate(
+            " grant execute on function f_abs to mamta3");
+        st_mamta3.executeUpdate(
+            " create table dhw(i int check(mamta1.f_abs(i) > 0))");
+        assertStatementError("23513", st_mamta3, "insert into dhw values 0");
+        assertStatementError
+            ("X0Y25", st,
+             "revoke execute on function f_abs from mamta3 restrict");
+        st_mamta3.executeUpdate(" drop table dhw");
+        st.executeUpdate("DROP FUNCTION F_ABS");
+
         // set connection mamta2
         //ij(MAMTA3)> -- DERBY-1847 SELECT statement asserts with 
         // XJ001 when attempted to select a newly added column 



Mime
View raw message