Lists: | pgsql-admin |
---|
From: | Thanh Q Lam <thanh(dot)q(dot)lam(at)alcatel(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | How to list user accounts? |
Date: | 2005-07-12 18:59:27 |
Message-ID: | 42D4130F.4060009@alcatel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-admin |
Hi,
Is there a command/option to list all database user accounts in postgres?
Thanks,
Thanh
From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Thanh Q Lam <thanh(dot)q(dot)lam(at)alcatel(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: How to list user accounts? |
Date: | 2005-07-12 19:10:53 |
Message-ID: | 20050712191053.GA22017@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-admin |
On Tue, Jul 12, 2005 at 14:59:27 -0400,
Thanh Q Lam <thanh(dot)q(dot)lam(at)alcatel(dot)com> wrote:
>
> Is there a command/option to list all database user accounts in postgres?
select usename from pg_user;
From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
---|---|
To: | Thanh Q Lam <thanh(dot)q(dot)lam(at)alcatel(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: How to list user accounts? |
Date: | 2005-07-12 19:12:25 |
Message-ID: | 1121195544.8208.242.camel@state.g2switchworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-admin |
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)
From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Thanh Q Lam <thanh(dot)q(dot)lam(at)alcatel(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: How to list user accounts? |
Date: | 2005-07-12 19:16:58 |
Message-ID: | 20050712191658.GA86144@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-admin |
On Tue, Jul 12, 2005 at 02:59:27PM -0400, Thanh Q Lam wrote:
>
> Is there a command/option to list all database user accounts in postgres?
If you're using psql then see "Meta-Commands" in the psql documentation;
otherwise see your client's documentation. You could also query
the system catalogs directly.
http://www.postgresql.org/docs/8.0/static/app-psql.html
http://www.postgresql.org/docs/8.0/static/catalogs.html
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/