Re: Connect without specifying a database? - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Connect without specifying a database?
Date
Msg-id 49E0B9CB.7090408@iol.ie
Whole thread Raw
In response to Connect without specifying a database?  ("lists@mgreg.com" <lists@mgreg.com>)
Responses Re: Connect without specifying a database?
List pgsql-general
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
------------------------------------------------------------------

pgsql-general by date:

Previous
From: Sam Mason
Date:
Subject: Re: Connect without specifying a database?
Next
From: "lists@mgreg.com"
Date:
Subject: Re: Connect without specifying a database?