How do I list all users and all databases.

Started by MattStanabout 24 years ago5 messagesgeneral
Jump to latest
#1MattStan
mattstan@blueyonder.co.uk

Hi everyone,

During testing of my postgresql install I created several users and
databases, now I can't remember exactly what I added. Can someone kindly
tell me how to list all user names and all databases, I can't seem to
work out how to do this. Thanks for your help.

-

#2Nigel J. Andrews
nandrews@investsystems.co.uk
In reply to: MattStan (#1)
Re: How do I list all users and all databases.

On Mon, 8 Apr 2002, MattStan wrote:

Hi everyone,

During testing of my postgresql install I created several users and
databases, now I can't remember exactly what I added. Can someone kindly
tell me how to list all user names and all databases, I can't seem to
work out how to do this. Thanks for your help.

In psql use \l to get the list of databases and SELECT * FROM pg_user; to get
user information.

--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants

#3Marin Dimitrov
marin.dimitrov@sirma.bg
In reply to: MattStan (#1)
Re: How do I list all users and all databases.

----- Original Message -----
From: "MattStan"

databases, now I can't remember exactly what I added. Can someone kindly
tell me how to list all user names and all databases, I can't seem to

select * from pg_database;

select * from pg_user;

see also "System Catalogs" chapter from the Developer's Guide

hth,

Marin

----
"...what you brought from your past, is of no use in your present. When
you must choose a new path, do not bring old experiences with you.
Those who strike out afresh, but who attempt to retain a little of the
old life, end up torn apart by their own memories. "

#4Oliver Elphick
olly@lfix.co.uk
In reply to: MattStan (#1)
Re: How do I list all users and all databases.

On Mon, 2002-04-08 at 16:09, MattStan wrote:

Hi everyone,

During testing of my postgresql install I created several users and
databases, now I can't remember exactly what I added. Can someone kindly
tell me how to list all user names and all databases, I can't seem to
work out how to do this. Thanks for your help.

SELECT * FROM pg_user;

SELECT * FROM pg_database; (or, in psql, \l)

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"And they questioned Him, saying "...Is it lawful for
us to pay taxes to Caesar, or not? ...And He said to
them "...render to Caesar the things that are
Caesar's, and to God the things that are God's."
Luke 20:21,22,25

#5Jeffrey W. Baker
jwbaker@acm.org
In reply to: MattStan (#1)
Re: How do I list all users and all databases.

On Mon, 2002-04-08 at 08:09, MattStan wrote:

Hi everyone,

During testing of my postgresql install I created several users and
databases, now I can't remember exactly what I added. Can someone kindly
tell me how to list all user names and all databases, I can't seem to
work out how to do this. Thanks for your help.

I don't know how to list users but 'psql -l' lists databases -jwb