O'Reilly logo

PostgreSQL 9 Administration Cookbook - Second Edition by Simon Riggs, Gianni Ciolli, Hannu Krosing, Gabriele Bartolini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The PostgreSQL superuser

In this recipe, you will learn how to turn a user into an all-powerful superuser and back to an ordinary user.

A PostgreSQL superuser is a user that can do anything in the database regardless of what privileges it has been granted.

How to do it…

A user becomes a superuser when it is created with the SUPERUSER attribute set:

CREATE USER username SUPERUSER;

A user can be deprived of its superuser status by removing the SUPERUSER attribute, using this command:

ALTER USER username NOSUPERUSER;

A user can be restored to superuser status later, using the following command:

ALTER USER username SUPERUSER;

When neither SUPERUSER nor NOSUPERUSER is given in the CREATE USER command, then the default is to create a user who is not a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required