Re: Multiple backend connections

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Doug McNaught <doug(at)mcnaught(dot)org>
Cc: Paul M Foster <paulf(at)quillandmouse(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple backend connections
Date: 2003-03-21 05:09:00
Message-ID: 9918.1048223340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Doug McNaught <doug(at)mcnaught(dot)org> writes:
> Paul M Foster <paulf(at)quillandmouse(dot)com> writes:
>> 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.

It's worth noting that there's a conflict between the use of template1
as the default template for CREATE DATABASE, versus its use as the
default database-to-connect-to for scripts like createuser. You could
get a failure from CREATE DATABASE if someone happens to be transiently
connected to template1 while creating a user or whatever.

This is a historical accident that arises from the fact that template1
is the only certain-to-exist database name (other than template0 which
is a recent innovation). We're probably going to have to change some
of this stuff eventually...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-03-21 05:17:50 Re: fieldwidths
Previous Message Thomas T. Thai 2003-03-21 04:51:22 pg_restore and adding a column