Re: Multiple backend connections

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: Multiple backend connections
Дата
Msg-id m3k7et7fir.fsf@varsoon.wireboard.com
обсуждение исходный текст
Ответ на Multiple backend connections  (Paul M Foster <paulf@quillandmouse.com>)
Ответы Re: Multiple backend connections
Список pgsql-general
Paul M Foster <paulf@quillandmouse.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

В списке pgsql-general по дате отправления: