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 ba...@apache.org on 2006/02/23 14:19:24 UTC
svn commit: r380112 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/sql/catalog/
engine/org/apache/derby/impl/sql/compile/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/tests/lang/
Author: bandaram
Date: Thu Feb 23 05:19:19 2006
New Revision: 380112
URL: http://svn.apache.org/viewcvs?rev=380112&view=rev
Log:
Add support for
1) Creating schemas with AUTHORIZATION option. Still need to enforce permission checks.
2) Upgrade support for grant & revoke. Tested full upgrade from 10.0 to 10.2 and 10.1 to 10.2.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevoke.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevoke.sql
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=380112&r1=380111&r2=380112&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java Thu Feb 23 05:19:19 2006
@@ -359,6 +359,12 @@
bootingDictionary.create_10_2_system_procedures(
tc,
bootingDictionary.getSystemUtilSchemaDescriptor().getUUID());
+
+ // Add new system catalogs created for grant and revoke
+ bootingDictionary.upgradeMakeCatalog(tc, DataDictionary.SYSTABLEPERMS_CATALOG_NUM);
+ bootingDictionary.upgradeMakeCatalog(tc, DataDictionary.SYSCOLPERMS_CATALOG_NUM);
+ bootingDictionary.upgradeMakeCatalog(tc, DataDictionary.SYSROUTINEPERMS_CATALOG_NUM);
+ bootingDictionary.upgradeMakeCatalog(tc, DataDictionary.SYSREQUIREDPERM_CATALOG_NUM);
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=380112&r1=380111&r2=380112&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Thu Feb 23 05:19:19 2006
@@ -9115,7 +9115,8 @@
QueryTreeNode
schemaDefinition() throws StandardException :
{
- String schemaName;
+ String schemaName = null;
+ String authName = null;
}
{
/*
@@ -9123,19 +9124,37 @@
** We are not currently handling character set
** specifications for schema, or schema bodies.
*/
- <SCHEMA> schemaName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
- {
+ <SCHEMA>
+ ( schemaName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true) [ <AUTHORIZATION> authName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true) ]
+ {
+ if (authName != null)
+ checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "AUTHORIZATION");
- if (schemaName.startsWith("SYS"))
- throw StandardException.newException(SQLState.INVALID_SCHEMA_SYS, schemaName);
+ if (schemaName.startsWith("SYS"))
+ throw StandardException.newException(SQLState.INVALID_SCHEMA_SYS, schemaName);
- return (QueryTreeNode) nodeFactory.getNode(
- C_NodeTypes.CREATE_SCHEMA_NODE,
- schemaName,
- null,
- getContextManager()
- );
- }
+ return (QueryTreeNode) nodeFactory.getNode(
+ C_NodeTypes.CREATE_SCHEMA_NODE,
+ schemaName,
+ authName,
+ getContextManager()
+ );
+ }
+ |
+ <AUTHORIZATION> authName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
+ {
+ checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "AUTHORIZATION");
+ if (authName.startsWith("SYS"))
+ throw StandardException.newException(SQLState.INVALID_SCHEMA_SYS, authName);
+
+ return (QueryTreeNode) nodeFactory.getNode(
+ C_NodeTypes.CREATE_SCHEMA_NODE,
+ authName,
+ authName,
+ getContextManager()
+ );
+ }
+ )
}
/*
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevoke.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevoke.out?rev=380112&r1=380111&r2=380112&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevoke.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/grantRevoke.out Thu Feb 23 05:19:19 2006
@@ -116,4 +116,22 @@
-----------
5
1 row selected
+ij(SATCONNECTION)> -- Test for AUTHORIZATION option for create schema
+-- GrantRevoke TODO: Need to enforce who can create which schema.
+-- More negative test cases need to be added once enforcing is done.
+CREATE SCHEMA MYDODO AUTHORIZATION DODO;
+0 rows inserted/updated/deleted
+ij(SATCONNECTION)> CREATE SCHEMA AUTHORIZATION DERBY;
+0 rows inserted/updated/deleted
+ij(SATCONNECTION)> select * from sys.sysschemas where schemaname not like 'SYS%';
+SCHEMAID |SCHEMANAME |AUTHORIZATIONID
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+xxxxFILTERED-UUIDxxxx|NULLID |DBA
+xxxxFILTERED-UUIDxxxx|SQLJ |DBA
+xxxxFILTERED-UUIDxxxx|APP |APP
+xxxxFILTERED-UUIDxxxx|SATHEESH |SATHEESH
+xxxxFILTERED-UUIDxxxx|AUTH_TEST |SATHEESH
+xxxxFILTERED-UUIDxxxx|MYDODO |DODO
+xxxxFILTERED-UUIDxxxx|DERBY |DERBY
+7 rows selected
ij(SATCONNECTION)>
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevoke.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevoke.sql?rev=380112&r1=380111&r2=380112&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevoke.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevoke.sql Thu Feb 23 05:19:19 2006
@@ -91,3 +91,13 @@
values f_abs(-5);
+-- Test for AUTHORIZATION option for create schema
+-- GrantRevoke TODO: Need to enforce who can create which schema.
+-- More negative test cases need to be added once enforcing is done.
+
+CREATE SCHEMA MYDODO AUTHORIZATION DODO;
+
+CREATE SCHEMA AUTHORIZATION DERBY;
+
+select * from sys.sysschemas where schemaname not like 'SYS%';
+