From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tom Ivar Helbekkmo <tih@kpnQwest.no>
Cc: Vince Vielhaber <vev@michvhf.com>
Cc: Roman Smirnov <smirnov@dresearch.de>
Cc: PostgreSQL conferention <pgsql-docs@postgresql.org>
Subject: Re: SQL query: List all the databases in the server
Date: Tue, 03 Jul 2001 10:45:49 -0400
Message-ID: <18380.994171549@sss.pgh.pa.us> (raw)
In-Reply-To: <86zoamdwbz.fsf@athene.i.eunet.no>
References: <Pine.BSF.4.30.0107030740100.56876-100000@paprika.michvhf.com>
<86zoamdwbz.fsf@athene.i.eunet.no>
Tom Ivar Helbekkmo <tih@kpnQwest.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, tih@kpnQwest.no, vev@michvhf.com, smirnov@dresearch.de
Subject: Re: SQL query: List all the databases in the server
In-Reply-To: <18380.994171549@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox