From: | "Dominic J(dot) Eidson" <sauron(at)the-infinite(dot)org> |
---|---|
To: | pgsql-hackers(at)hub(dot)org |
Subject: | Re: postgres 7.0.2 |
Date: | 2000-08-22 17:04:27 |
Message-ID: | Pine.LNX.4.10.10008221201580.25131-100000@morannon.the-infinite.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 usesysid FROM 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-08-22 17:06:47 | Re: postgres 7.0.2 |
Previous Message | hstenger | 2000-08-22 17:02:46 | Re: How Do You Pronounce "PostgreSQL"? |