is_superuser

A system parameter indicating whether the current user is a superuser

is_superuser is a read-only configuration parameter which indicates whether the current user is a superuser.

is_superuser was added in PostgreSQL 7.4.

Usage

is_superuser was added for internal use, specifically to enable display of superuser status in the psql prompt.

As of PostgreSQL 15, is_superuser is not documented.

libpq

is_superuser is one of the parameters reported to the libpq connection and can be queried with:

PQparameterStatus(conn, "is_superuser")

Change history

Examples

Basic usage example for is_superuser:

postgres=> SELECT current_user;
 current_user 
--------------
 foo
(1 row)

postgres=> SHOW is_superuser;
 is_superuser 
--------------
 off
(1 row)

postgres=> \c - postgres
You are now connected to database "postgres" as user "postgres".

postgres=# SHOW is_superuser;
 is_superuser 
--------------
 on
(1 row)

It is not possible to modify is_superuser:

postgres=# SET is_superuser = off;
ERROR:  parameter "is_superuser" cannot be changed

Categories

GUC configuration item, Undocumented feature, Users and roles

See also

current_user