Thread: How can I recreate the template0 database?

How can I recreate the template0 database?

From
Eduardo Mambrilla Martínez
Date:
I made a mistake, I droped the template0 database...
How can I recreate it?

Thanks


Attachment

Re: How can I recreate the template0 database?

From
Scott Marlowe
Date:
On Wed, 2005-03-09 at 01:32, Eduardo Mambrilla Martínez wrote:
> I made a mistake, I droped the template0 database...
> How can I recreate it?

Do you still have template1?  If so, connect in single user mode, enter:
postgres template1
create database template0 with template template1
update pg_database set datallowconn = false where datname='template0';

Use CTRL-D to exit.

Re: How can I recreate the template0 database?

From
Alvaro Herrera
Date:
On Mon, Mar 14, 2005 at 09:59:14AM -0600, Scott Marlowe wrote:
> On Wed, 2005-03-09 at 01:32, Eduardo Mambrilla Martínez wrote:
> > I made a mistake, I droped the template0 database...
> > How can I recreate it?
>
> Do you still have template1?  If so, connect in single user mode, enter:
> postgres template1
> create database template0 with template template1
> update pg_database set datallowconn = false where datname='template0';

I think it'd be wise to issue a VACUUM FULL; VACUUM FREEZE in the newly
created template0 before disallowing connections to it.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"El número de instalaciones de UNIX se ha elevado a 10,
y se espera que este número aumente" (UPM, 1972)