I dropped a user from an Amazon Redshift database, but the user still appears in the pg_class table
Why do deleted Amazon Redshift users still appear in the pg_class table but not the pg_user table?
Deleted users can still appear in the pg_class table when the dropped user owns an object in another database in the cluster. The DROP USER command only checks the current database for objects that are owned by the user who is about to be dropped. If the user owns an object in another database, then no errors are thrown. Instead, the dropped user retains ownership of the object and the usesysid still appears in the pg_class table.
Run the following command on each database in your cluster. This command checks for objects that are owned by deleted users.
select distinct schemaname, tablename, tableowner from pg_tables where tableowner like '%unknown%';
If a deleted user still owns objects in a database, you get an output similar to the following. The tableowner is "unknown" because the owner was deleted from the pg_user table, where usenames are stored.