Thread: template Database

template Database

From
"Bob T"
Date:
I installed Cygwin on WInXP..with Cygwin I installed/initialized Postgresql.
However when completed I had a template0 and a template1.
Maybe I initialzed twice..not sure.
 
 Template0 is unuseable and refuses connections. Template1 is the default
template database. I tried but can not drop template0. How do I rid my server of the useless template0. The server consol will and does show Fatals when
inoperation.
 
So How do I drop the useless template?
 
BobT

Re: template Database

From
flume33@yahoo.com
Date:
I think you want template0 and template1 because they can do important
things. Using the psql program type (or one of the GUI database front
ends like pgPhpAdmin):



         CREATE DATABASE test;


This should get you going. However, I think  "DROP template1" might be
really bad and might require another initdb or reinstall (not sure :(
I would reinstall just to be safe :)


Jeff


<excerpt><fontfamily><param>Arial</param><smaller> Template0 is
unuseable and refuses connections. Template1 is the default</smaller></fontfamily>

<fontfamily><param>Arial</param><smaller>template database. I tried
but can not drop template0. How do I rid my server of the useless
template0. The server consol will and does show Fatals when</smaller></fontfamily>

<fontfamily><param>Arial</param><smaller>inoperation.</smaller></fontfamily>

 

<fontfamily><param>Arial</param><smaller>So How do I drop the useless
template?</smaller></fontfamily>

 

<fontfamily><param>Arial</param><smaller>BobT</smaller></fontfamily>

</excerpt>I think you want template0 and template1 because they can do important
things. Using the psql program type (or one of the GUI database front
ends like pgPhpAdmin):

          CREATE DATABASE test;

This should get you going. However, I think  "DROP template1" might be
really bad and might require another initdb or reinstall (not sure :( I
would reinstall just to be safe :)

Jeff

>  Template0 is unuseable and refuses connections. Template1 is the
> default
> template database. I tried but can not drop template0. How do I rid my
> server of the useless template0. The server consol will and does show
> Fatals when
> inoperation.
>  
> So How do I drop the useless template?
>  
> BobT

Re: template Database

From
"Arguile"
Date:
Heh, you might want to keep those around.

Both Template0 and Template1 are system database that are essential to the
operation of PosgreSQL.

Check out the following for an indepth explanation:

http://developer.postgresql.org/docs/postgres/managing-databases.html#MANAGE
-AG-TEMPLATEDBS

Bob T wrote:
> I installed Cygwin on WInXP..with Cygwin I installed/initialized
> Postgresql.
> However when completed I had a template0 and a template1.
> Maybe I initialzed twice..not sure.

>  Template0 is unuseable and refuses connections. Template1 is the
> default
> template database. I tried but can not drop template0. How do I rid
> my server of the useless template0. The server consol will and does
> show Fatals when inoperation.

> So How do I drop the useless template?

BobT



Re: template Database

From
"Darko Prenosil"
Date:
Taken from documentation:
 
CREATE DATABASE actually works by copying an existing database. By default, it copies the standard system database named template1. Thus that database is the "template" from which new databases are made. If you add objects to template1, these objects will be copied into subsequently created user databases. This behavior allows site-local modifications to the standard set of objects in databases. For example, if you install the procedural language plpgsql in template1, it will automatically be available in user databases without any extra action being taken when those databases are made.
 
There is a second standard system database named template0. This database contains the same data as the initial contents of template1, that is, only the standard objects predefined by your version of PostgreSQL. template0 should never be changed after initdb. By instructing CREATE DATABASE to copy template0 instead of template1, you can create a "virgin" user database that contains none of the site-local additions in template1. This is particularly handy when restoring a pg_dump dump: the dump script should be restored in a virgin database to ensure that one recreates the correct contents of the dumped database, without any conflicts with additions that may now be present in template1.
----- Original Message -----
From: Bob T
Sent: Sunday, February 24, 2002 6:10 AM
Subject: [GENERAL] template Database

I installed Cygwin on WInXP..with Cygwin I installed/initialized Postgresql.
However when completed I had a template0 and a template1.
Maybe I initialzed twice..not sure.
 
 Template0 is unuseable and refuses connections. Template1 is the default
template database. I tried but can not drop template0. How do I rid my server of the useless template0. The server consol will and does show Fatals when
inoperation.
 
So How do I drop the useless template?
 
BobT