2014-03-18 6:54 GMT+09:00 Kasia Tuszynska <ktuszynska@esri.com>:
> Ian,
> Thanks that is the really only doc that comes up when I search for this. It discusses how to call a template to
createa new db, but it does not list the differences between them. I am going to try to just find a definition of both.
Basically, "template1" is the default template used for creating new databases.
Normally template1 and template0 are identical, however it's possible
to customise
template1 if there are some modifications you wish to have automatically in
all new databases:
template1=# CREATE LANGUAGE plperlu;
CREATE LANGUAGE
Time: 1033.037 ms
template1=# CREATE DATABASE foo;
CREATE DATABASE
Time: 3267.212 ms
template1=# \c foo
You are now connected to database "foo" as user "barwick".
foo=# \dL
List of languages
Name | Owner | Trusted | Description
---------+---------+---------+------------------------------
plperlu | barwick | f |
plpgsql | barwick | t | PL/pgSQL procedural language
(2 rows)
template0 cannot be changed and serves as a "backup" if you need
to restore template1, or create a new database without the customisations
in template1.
Regards
Ian Barwick