Re: SQL query: List all the databases in the server - Mailing list pgsql-docs

From Vince Vielhaber
Subject Re: SQL query: List all the databases in the server
Date
Msg-id Pine.BSF.4.30.0107030740100.56876-100000@paprika.michvhf.com
Whole thread Raw
In response to SQL query: List all the databases in the server  (Roman Smirnov <smirnov@dresearch.de>)
Responses Re: SQL query: List all the databases in the server
List pgsql-docs
On Tue, 3 Jul 2001, Roman Smirnov wrote:

> Hi all!
>
> I need SQL analog of \l command from psql.
> Something like "list databases".

If you just want a list of them you can get it from pg_database:

select datname from pg_database;

if you also want the username of the database owner you'll have to
cross pg_database.datdba to pg_user.usesysid something like this:

select d.datname,u.usename from pg_database d, pg_user u where d.datdba = u.usesysid;

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
         56K Nationwide Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




pgsql-docs by date:

Previous
From: Roman Smirnov
Date:
Subject: SQL query: List all the databases in the server
Next
From: Justin Clift
Date:
Subject: Re: replication