Re: SQL to list databases?

Поиск
Список
Период
Сортировка
От Roberto Mello
Тема Re: SQL to list databases?
Дата
Msg-id 20030124035240.GA4123@cc.usu.edu
обсуждение исходный текст
Ответ на Re: SQL to list databases?  (Kristopher Yates <kris@grinz.com>)
Список pgsql-sql
On Thu, Jan 23, 2003 at 02:33:55PM -0600, Kristopher Yates wrote:
> I have been wondering the same thing..  

SELECT * FROM pg_databases ?

> >Is there a query that will return all the databases available, similar 
> >to what psql -l does?

The handy "-E" flag to psql helps:

roberto@brasileiro:~$ psql -E -l
********* QUERY **********
SELECT d.datname as "Name",      u.usename as "Owner",      pg_encoding_to_char(d.encoding) as "Encoding"
FROM pg_database d LEFT JOIN pg_user u ON d.datdba = u.usesysid
ORDER BY 1;
**************************
          List of databases     Name      |   Owner    | Encoding 
----------------+------------+----------addresses      | windozefoo | LATIN1foobar         | roberto    |
LATIN1openacs-4     | roberto    | LATIN1template0      | postgres   | LATIN1template1      | postgres   | LATIN1
 

-Roberto

-- 
+----|        Roberto Mello   -    http://www.brasileiro.net/  |------+
+       Computer Science Graduate Student, Utah State University      +
+       USU Free Software & GNU/Linux Club - http://fslc.usu.edu/     +
Dente lupus, cornu taurus petit.


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

Предыдущее
От: "Luke Pascoe"
Дата:
Сообщение: CAST from VARCHAR to INT
Следующее
От: Roberto Mello
Дата:
Сообщение: Re: Scheduling Events?