Hi all, How does one go about disabling a super user account within postgres without deleting it. I looked at the Alter Role documentation and I am drawing blanks. In addition this is the only super user account and the subordinate accounts own the tables that they are responsible for
+1
A:
I assume that you have created a new user with super user privileges and you don't want to disable the postgres account, right?
To disable an account try revoke:
REVOKE ALL PRIVILEGES
ON DATABASE mydb
FROM mysuperuser;
I might have missed something in the snippet above, check out the docs here: http://www.postgresql.org/docs/8.4/static/sql-revoke.html
To remove the user, become super user yourself, ie postgres. Then use DROP ROLE:
DROP ROLE mysuperuser;
http://www.postgresql.org/docs/8.4/interactive/sql-droprole.html
John P
2010-08-02 18:20:01
+1
A:
There is always a superuser, you can't maintain your database without this role.
Frank Heikens
2010-08-02 19:17:35
Any documents to validate this?
Woot4Moo
2010-08-03 01:06:36
Just check the manual, many statements need a superuser (CREATE LANGUAGE is one of them) and you need a superuser to create a superuser role. Without a superuser, you're on a dead end street.
Frank Heikens
2010-08-03 06:01:49
Thanks. So logically my argument is going to be that a non super user does not have the necessary rights to grant privileges back to my super user in the case of maintenance
Woot4Moo
2010-08-03 12:59:43
+2
A:
You could configure pg_hba.conf
to reject the super user so it can't log in.
xenoterracide
2010-08-03 22:52:14
Indeed. Disabling login would effectively disable the account. Also seems to be the pattern Linux and some Windows installations follow.
aib
2010-08-03 23:20:34