Re: How to list databases with SQL statement?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: How to list databases with SQL statement?
Дата
Msg-id 20041123045640.GA22766@winnie.fuhr.org
обсуждение исходный текст
Ответ на How to list databases with SQL statement?  (Marian D Marinov <hackman@hydra.azilian.net>)
Список pgsql-general
On Sat, Nov 20, 2004 at 12:39:38AM +0000, Marian D Marinov wrote:

> Is there a way to list all databases which belong to the current user with an
> SQL query?

Such information is in the system catalogs:

http://www.postgresql.org/docs/7.4/static/catalogs.html

If you run psql with the -E option, you can see the queries that
psql makes when you issue commands like \l to show the list of
databases and their owners.  You can then copy those queries and
modify them to meet your needs.

The name of the current user is available as CURRENT_USER and
SESSION_USER -- see the Miscellaneous Functions documentation for
the difference:

http://www.postgresql.org/docs/7.4/static/functions-misc.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

В списке pgsql-general по дате отправления:

Предыдущее
От: Quinton Delpeche
Дата:
Сообщение: Re: How to list databases with SQL statement?
Следующее
От: John DeSoi
Дата:
Сообщение: Re: How to list databases with SQL statement?