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 | LATIN1
 foobar         | roberto    | LATIN1
 openacs-4      | roberto    | LATIN1
 template0      | postgres   | LATIN1
 template1      | 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.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to