On Thu, Feb 10, 2005 at 12:50:23PM +0100, Murray Cumming wrote:
> Can PQconnectdb(), or something else, be used without specifying the
> dbname in the connection string? I want to connect just so that I can
> create a database that does not exist yet.
See "Environment Variables" in the libpq chapter of the documentation:
> When I don't specify the dbname, PQconnectdb() tries to connect to a
> database with the same name as the user, and then complains that it does
> not exist. Is it really necessary for each user to have an empty
> database like this?
No, but you have to connect to *some* database. As Robert Treat
mentioned, you could connect to template1 if you just need to issue
a CREATE DATABASE statement.
In response to
pgsql-interfaces by date
|Next:||From: Michael Fuhr||Date: 2005-02-10 14:46:54|
|Subject: Re: Function return number of affected rows|
|Previous:||From: Robert Treat||Date: 2005-02-10 13:12:08|
|Subject: Re: Connecting without specifying a database|