Skip to content

Instantly share code, notes, and snippets.

@adevil5
Last active October 22, 2022 14:20
Show Gist options
  • Save adevil5/20d7b9ba670133cc04f8fef8054d2a15 to your computer and use it in GitHub Desktop.
Save adevil5/20d7b9ba670133cc04f8fef8054d2a15 to your computer and use it in GitHub Desktop.
Drop Postgres User
-- (Optional) Change password to something unknown to the user
ALTER user my_user WITH PASSWORD 'delete-me';
-- Shift ownership of objects to another user
REASSIGN OWNED BY my_user TO postgres;
-- Drop any privledges granted to the user (not sure why this isn't done automatically)
DROP OWNED BY my_user;
-- Drop the user
DROP user my_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment