Re: Getting a Database List

From: terry(at)greatgulfhomes(dot)com
To: "'Lee'" <lee(at)dev(dot)null(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting a Database List
Date: 2002-07-25 12:32:05
Message-ID: 002601c233d7$48fe3640$2766f30a@development.greatgulfhomes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can use \l

Which is just an alias for the query:
SELECT d.datname as "Name",
u.usename as "Owner"
FROM pg_database d LEFT JOIN pg_user u ON d.datdba = u.usesysid
ORDER BY 1;

(in case you prefer to do the actual query)

Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry(at)greatgulfhomes(dot)com

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Lee
> Sent: Wednesday, July 24, 2002 10:55 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Getting a Database List
>
>
> I need to know the interactive SQL syntax to get a listing of
> databases on
> the current server.
>
> Using Informix, the commands would be:
> database sysmaster;
> select name from sysdatabases;
>
> MySQL:
> show databases;
>
> MS-SQL:
> SELECT name FROM master..sysdatabases ORDER BY name
>
> Please reply by posting to this newsgroup. My email address
> is hashed to
> protect me from spamming.
>
> Thanks,
> Lee
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bjoern Metzdorf 2002-07-25 12:35:20 Re: erserver
Previous Message Andrew Sullivan 2002-07-25 12:22:37 Re: erserver