On 11/04/2009 16:30, lists@mgreg.com wrote:
> Quick question: Does PGSQL provide a mechanism by which to connect to
> the server without specifying a database? I saw a thread back in 2005
> that said "no"
> (http://archives.postgresql.org//pgsql-interfaces/2005-02/msg00031.php),
> but I was curious as to whether that's changed. Basically I need to be
> able to dynamically determine what databases exist etc before performing
> certain actions in my application.
The answer is still "no". :-)
The usual thing it to connect to the "postgres" database (or to
"template1" in older versions of PG), and then you can issue queries to
see what's there. You're pretty much guaranteed that one of those
databases will exist (they're created by initdb), unless whoever
installed the server did something strange.
Ray.
------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------