Re: Multiple backend connections - Mailing list pgsql-general

From Paul M Foster
Subject Re: Multiple backend connections
Date
Msg-id 20030320031020.GB6807@quillandmouse.com
Whole thread Raw
In response to Re: Multiple backend connections  (Doug McNaught <doug@mcnaught.org>)
Responses Re: Multiple backend connections  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Mar 19, 2003 at 06:39:06PM -0500, Doug McNaught wrote:

> Paul M Foster <paulf@quillandmouse.com> writes:
>
> > I've written code to connect to and/or create databases in C. To check
> > my work, I'll open up psql in another console. But if I'm connected to
> > the default database (template1), and attempt to connect to that
> > database in my C program, it fails.
>
> This shouldn't happen, unless you're at your connection limit for
> Postgres (32 by default), or running out of kernel file descriptors or
> something.
>
> What is the exact error you're getting in the C program?

Well, in a C program, you don't get an error message per se. But I
inserted a call to PQresultErrorMessage() and the result is:

ERROR: CREATE DATABASE: source database "template1" is being accessed by
other users

The circumstances are that in one console, I'm connected in psql to the
template1 database. In a different console (same username) my C program
attempts to connect to a non-existent database. Failing this, it then
attempts to connect to template1 in order to create the other database.
But it can't connect to template1.

This is a Debian 3.0r1 workstation, running PostgreSQL 7.2.1.

Paul

P.S. BTW, I'm s*bscr*bed, so no need to echo lists posts offlist to me.

pgsql-general by date:

Previous
From: "pg"
Date:
Subject: Re: ssl
Next
From: James Gregory
Date:
Subject: trigger troubles