Effects of Dropping a User on Database Privileges
When you drop a user, the system deletes from dictionary tables individual privileges granted directly to the dropped user and privileges granted through role assignment.
Dropping database objects that exist in the user space before the DROP USER statement (required) removes any privileges on the objects from roles and other users or databases.
Any privileges granted by the dropped user on objects outside the user space remain in the system.
Effects of Dropping a User on User-Created Roles and Profiles
Roles and profiles created by a dropped user remain in the system after the user is dropped.
Journal Tables
If a user contains a journal table in its space, then the user cannot be dropped until the journal table is removed from the system. A MODIFY USER statement must be used to drop the journal table.
Join Indexes
If a user contains a table referenced by a join index contained in a different database or user, then you cannot drop the user that contains the referenced table unless you first drop the referencing join index.
See DROP JOIN INDEX for more information.
Triggers
If a user contains a table referenced by a trigger contained within a different database or user, then you cannot drop the user that contains the referenced table unless you first drop the referencing trigger.
For more information, see DROP TRIGGER.
Query Bands
You cannot drop a user who is logged on as a trusted or permanent user through a proxy connection.
When you drop a user who is a trusted or permanent proxy user, the system deletes the rows for that user in DBC.ConnectRulesTbl.
DBQL Rules
Before you can drop a user for whom one or more DBQL rules have been created, you must first remove those rules for that user. See DROP USER Examples.
Dropping a Populated User
- Drop any join indexes in another database or user that reference a table in the current user. See DROP JOIN INDEX.
- Drop any triggers in another database or user that reference a table in the current user. See DROP MACRO.
- Drop any journal tables in the current user. See MODIFY USER.
- Perform either of the following procedures:
- Delete the current user. See DELETE USER.
- Drop all the objects within the current user.See the appropriate statement set from the following list for more information:
- Drop the current user.
DROP Processes
The drop operation verifies that the user is empty, checks that the user does not own any other databases or users, drops the user, and adds the PERM and TEMPORARY space that the drop makes available to that of the immediate owner database or user.
You must restore a dropped user before you can recover it using the Dump and Restore utility.
DROP USER and Locks
When a DROP USER statement is processed, the system places an EXCLUSIVE lock on the user being dropped.
- An all-AMP WRITE lock is placed on the partition range assigned to objects in the dropped user/database. Although DROP USER can run only after all objects in the user have been dropped, a final delete is done to clean up any leftover privileges on the user's dropped objects.
- For DROP USER only, an optional single-AMP WRITE lock is placed on the user RowHash in all partitions if the user has been granted explicit privileges on objects in other users or databases that need to be deleted.
Drop Processes and Java External Procedures
After a DROP USER request has been processed successfully, and before returning its status to the client application, the UDF symbol cache must be spoiled. This is done as part of the dictionary cache spoiling process. Because you must successfully submit a DELETE USER request before you can submit the DROP USER request, these actions have already occurred. See DELETE USER.
- The system checks DBC.Jar_Jar_Usage to determine if any JARs in the user to be deleted are in the SQL-Java path of another JAR.
If so, the request aborts and the system returns an error to the requestor.
- Delete all rows in DBC.Jar_Jar_Usage where the value for the JarDatabaseId column matches the ID of the user to be deleted.
- Delete all rows in DBC.Routine_Jar_Usage where the value for the DatabaseId column matches the ID of the user to be deleted.
- Delete all rows in DBC.Jars where the value for the DatabaseId matches the ID of the user to be deleted.
Referenced Objects
You cannot drop a user in which a join index is defined without first dropping the index.
You cannot drop a user that contains a table on which a join index is defined without first dropping the index.