| From: | Larry Rosenman <ler(at)lerctr(dot)org> | 
|---|---|
| To: | Ben Siders <bsiders(at)cms-stl(dot)com>, pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: SQL to list databases? | 
| Date: | 2003-01-23 20:30:31 | 
| Message-ID: | 60030000.1043353831@lerlaptop.iadfw.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
--On Thursday, January 23, 2003 12:56:50 -0600 Ben Siders 
<bsiders(at)cms-stl(dot)com> wrote:
>
> Is there a query that will return all the databases available, similar to
> what psql -l does?
>
$ psql -E -l
********* QUERY **********
SELECT d.datname as "Name",
       u.usename as "Owner",
       pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding"
FROM pg_catalog.pg_database d
  LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid
ORDER BY 1;
**************************
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kristopher Yates | 2003-01-23 20:33:55 | Re: SQL to list databases? | 
| Previous Message | Luke Pascoe | 2003-01-23 20:19:51 | checking data integrity in a recursive table |