Re: Multiple backend connections

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Paul M Foster <paulf(at)quillandmouse(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple backend connections
Date: 2003-03-21 00:02:52
Message-ID: m3k7et7fir.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Paul M Foster <paulf(at)quillandmouse(dot)com> writes:

> 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?

No, it uses template1.

> 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?

template1 is the default template. You can add types, PLs etc to it
and they will be copied to any other databases you create.

template0 is the 'virgin' template, for use if you mess up template1
or if you want to create a database without all the extra stuff you
put in template1.

> 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?

You are correct. The best practice is to stay out of template1 unless
you are creating a new database or adding stuff to template1.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-03-21 00:13:48 Re: system table backup strategy
Previous Message Steve Crawford 2003-03-21 00:01:49 Re: system table backup strategy