Re: Multiple backend connections

From: Paul M Foster <paulf(at)quillandmouse(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple backend connections
Date: 2003-03-20 23:40:15
Message-ID: 20030320234015.GA14302@quillandmouse.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 19, 2003 at 11:35:53PM -0500, Tom Lane wrote:

> Paul M Foster <paulf(at)quillandmouse(dot)com> writes:
> >> What is the exact error you're getting in the C program?
>
> > ERROR: CREATE DATABASE: source database "template1" is being accessed by
> > other users
>
> Please note this is CREATE DATABASE complaining, *not* connection
> establishment. You can't create a database by cloning an open database
> (there are not locks that would make this safe). Either don't use
> template1 for normal operations, or use template0 as the template for
> CREATE DATABASE.

Excuse my ignorance here.

I'll summarize, and someone can tell me if I'm wrong.

1. So when you create a database, the system uses the open database
you're connected to as a "template" unless you specify otherwise with a
"WITH TEMPLATE = " clause?

2. Since template0 does not accept connections, can I assume that it
exists for the sole purpose of acting as a template for the creation of
other databases?

3. Am I correct in assuming that you need to specify a database in order
to connect to PostgreSQL, and that, on a "virgin" system, template1 is
the database provided for that purpose? If it isn't necessary to specify
a database in order to connect, how would you otherwise do it?

Paul

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tracy Gong 2003-03-20 23:44:18 unsubscribe
Previous Message Tom Lane 2003-03-20 23:14:38 Re: ERROR: out of free buffers: time to abort!