Re: log activity questions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "Marc Fromm" <Marc(dot)Fromm(at)wwu(dot)edu>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: log activity questions
Date: 2008-10-15 00:43:35
Message-ID: 6592.1224031415@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> writes:
> Template0 is your "man, I really screwed up template1" get out of jail
> free database. It is normally set to not allow connections (look at
> "select * from pg_databases;" for the field that does or doesn't allow
> connections). If you ever did terrible things to templat1, you could
> set template0 to datallowcon=t and then drop and recreate template1
> using template0 as the template. Then vacuum freeze it and set it to
> not allow connections again to template0 to get it back to normal
> again.

You don't need to (and shouldn't) touch datallowconn while doing the
above. Just use some third database to launch the "DROP DATABASE
template1" and "CREATE DATABASE template1 WITH TEMPLATE template0"
commands.

BTW: the other, more common use of template0 is as a template for making
a database to restore a dump into. If you use template1 then any local
additions in template1 pose a hazard for the dump (which probably also
tries to define those objects).

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2008-10-15 02:12:36 Re: LDAP authentication
Previous Message Scott Marlowe 2008-10-15 00:38:16 Re: log activity questions