Thank you for the script files, makes life easy! Just a small edit: The proc.psql file was missing one SQL statement @line 96:
delete from x_user_module_perm where user_id = x_portal_user_id;
We were facing the below issue while trying the commands from psql file manually:
ERROR: update or delete on table "x_portal_user" violates foreign key constraint "x_user_module_perm_fk_userid" on table "x_user_module_perm"
DETAIL: Key (id)=(19) is still referenced from table "x_user_module_perm"
Because of the above blocker, the script was not deleting the users from the DB.
Once we added the missing SQL statement and ran the deleteRangerUser.sh we were able to use it with successful results.