On Tue, 22 Aug 2000, Thomas Swan wrote:
> Actually, I think I understand the question. The original person wants to
> be able to do a query and get a result containing a list of
> databases. AFAIK, there isn't a way to do this using standard SQL-like
> statements. Somebody correct me if I'm wrong.
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
usesysidFROM pg_user) ORDER BY "Database";
(Which is what psql sends to the backend in response to the "\l" command.)
--
Dominic J. Eidson "Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/