From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Tom Ivar Helbekkmo <tih(at)kpnQwest(dot)no> |
Cc: | Vince Vielhaber <vev(at)michvhf(dot)com>, Roman Smirnov <smirnov(at)dresearch(dot)de>, PostgreSQL conferention <pgsql-docs(at)postgresql(dot)org> |
Subject: | Re: SQL query: List all the databases in the server |
Date: | 2001-07-03 14:45:49 |
Message-ID: | 18380.994171549@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Tom Ivar Helbekkmo <tih(at)kpnQwest(dot)no> writes:
> The above SELECT is extensively reformatted from the strings it's
> built from in the source file, of course.
An even easier way to see what queries psql emits for its backslash
commands is to start psql with -E option, then do the backslash
commands. This gives me, for example,
regression=# \l
********* QUERY **********
SELECT pg_database.datname as "Database",
pg_user.usename as "Owner"FROM pg_database, pg_user
WHERE pg_database.datdba = pg_user.usesysid
UNION
SELECT pg_database.datname as "Database",
NULL as "Owner"FROM pg_database
WHERE pg_database.datdba NOT IN (SELECT usesysid FROM pg_user)
ORDER BY "Database"
**************************
List of databases
Database | Owner
------------+----------
regression | postgres
template0 | postgres
template1 | postgres
(3 rows)
regression=#
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Roman Smirnov | 2001-07-03 15:33:03 | Re: SQL query: List all the databases in the server |
Previous Message | Tom Ivar Helbekkmo | 2001-07-03 12:35:28 | Re: SQL query: List all the databases in the server |