database-template

How does one drop a template database from PostgreSQL?

天涯浪子 提交于 2019-12-20 08:35:13
问题 postgres=# DROP DATABASE template_postgis; ERROR: cannot drop a template database http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html makes it seem like if I set template_postgis.datistemplate = false , I'll be able to drop it, but I don't know how to set that. 回答1: postgres=# UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis'; UPDATE 1 postgres=# DROP DATABASE template_postgis; DROP DATABASE postgres=# 回答2: You can use the alter database command.

How does one drop a template database from PostgreSQL?

房东的猫 提交于 2019-12-02 16:07:38
postgres=# DROP DATABASE template_postgis; ERROR: cannot drop a template database http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html makes it seem like if I set template_postgis.datistemplate = false , I'll be able to drop it, but I don't know how to set that. postgres=# UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis'; UPDATE 1 postgres=# DROP DATABASE template_postgis; DROP DATABASE postgres=# You can use the alter database command. Much simpler and safer than upsetting metadata. postgres=# create database tempDB is_template true; CREATE