From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Thanh Q Lam <thanh.q.lam@alcatel.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: How to list user accounts?
Date: Tue, 12 Jul 2005 14:12:25 -0500
Message-ID: <1121195544.8208.242.camel@state.g2switchworks.com> (raw)
In-Reply-To: <42D4130F.4060009@alcatel.com>
References: <42D4130F.4060009@alcatel.com>
On Tue, 2005-07-12 at 13:59, Thanh Q Lam wrote:
> Hi,
>
> Is there a command/option to list all database user accounts in postgres?
From the psql monitor:
\du
via sql:
SELECT u.usename AS "User name",
u.usesysid AS "User ID",
CASE WHEN u.usesuper AND u.usecreatedb THEN CAST('superuser, create
database' AS pg_catalog.text)
WHEN u.usesuper THEN CAST('superuser' AS pg_catalog.text)
WHEN u.usecreatedb THEN CAST('create database' AS
pg_catalog.text)
ELSE CAST('' AS pg_catalog.text)
END AS "Attributes"
FROM pg_catalog.pg_user u
ORDER BY 1;
(what psql does behind the scenes when you type \du)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: smarlowe@g2switchworks.com, thanh.q.lam@alcatel.com
Subject: Re: How to list user accounts?
In-Reply-To: <1121195544.8208.242.camel@state.g2switchworks.com>
References: <42D4130F.4060009@alcatel.com> <1121195544.8208.242.camel@state.g2switchworks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox