postgres=# DROP DATABASE template_postgis;
ERROR: cannot drop a template database
http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html 看起来好像如果我设置 template_postgis.datistemplate = false
,我就可以删除它,但是我不知道如何设置。
postgres=# DROP DATABASE template_postgis;
ERROR: cannot drop a template database
http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html 看起来好像如果我设置 template_postgis.datistemplate = false
,我就可以删除它,但是我不知道如何设置。
postgres=# UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis';
UPDATE 1
postgres=# DROP DATABASE template_postgis;
DROP DATABASE
postgres=#
postgres=# create database tempDB is_template true;
CREATE DATABASE
postgres=# drop database tempDB;
ERROR: cannot drop a template database
postgres=# alter database tempDB is_template false;
ALTER DATABASE
postgres=# drop database tempDB;
DROP DATABASE
postgres=#
'false'
周围添加单引号 POSTGRES v10 - Luis Villavicenciotemplate0
和template1
数据库:ALTER DATABASE template0 IS_TEMPLATE FALSE;
DROP DATABASE template0;
ALTER DATABASE template1 IS_TEMPLATE FALSE;
DROP DATABASE template1;
update pg_database set datistemplate=false where datname='template0';
update pg_database set datistemplate=false where datname='template1';
....
Creating script to analyze new cluster ok
Creating script to delete old cluster ok
Checking for hash indexes ok
Upgrade Complete
----------------
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
。 - dbkapluncreate database template1 template template0;
UPDATE pg_database SET datistemplate='true' WHERE datname='template1';
参考链接:http://pgsql.inb4.se/2009/april/rebuild-template1.html - Sam Watkins