this is nothing new, but i blog it to have a place to point people to.
let's assume you accidentally loaded dump file in template1 database.
this is definitely not something one could have wanted (i mean i can see some uses for this but it's not really likely).
so, now you want to cleanup your template1.
how? that's easy.
connect with your superuser account (postgres) to some database other than template1.
and then issue these queries:
- # update pg_database set datistemplate = false where datname = ‘template1';
- # drop database template1;
- # create database template1 with template template0;
- # update pg_database set datistemplate = true where datname = ‘template1';
be sure that there is no connection to template1 at the moment you're dealing with it.
and that's all. nothing really complicated.