Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 35260 invoked from network); 9 Jul 2008 09:54:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jul 2008 09:54:27 -0000 Received: (qmail 60735 invoked by uid 500); 9 Jul 2008 09:54:28 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 60703 invoked by uid 500); 9 Jul 2008 09:54:28 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 60694 invoked by uid 99); 9 Jul 2008 09:54:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jul 2008 02:54:28 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jul 2008 09:53:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EB92923889F1; Wed, 9 Jul 2008 02:54:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: dag@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080709095406.EB92923889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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