====== recreate template1 ====== You cannot drop a template database so you first have to tell postgres that this isn't one. This process is useful if you want to get ride of things that might have been added to template1 over time and you want to get back to a plain db such as when postgres was first installed. template1 is used to create new databases, so anything in template1 goes into them. update pg_database set datistemplate = false where datname='template1'; drop database template1; create database template1 encoding='UTF-8' template=template0; update pg_database set datistemplate = true where datname='template1';