highgo=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
--------------+--------------+----------+------------+------------+-------------------
benchmarksql | benchmarksql | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db0 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db1 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db10 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db100 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db1000 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
highgo | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
template0 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/highgo +
| | | | | highgo=CTc/highgo
template1 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/highgo +
| | | | | highgo=CTc/highgo
(9 rows)
highgo=# drop database template1;
错误: 42809: 无法删除模板数据库
highgo=# UPDATE pg_database SET datistemplate='false' WHERE datname='template1';
UPDATE 1
highgo=# drop database template1;
DROP DATABASE
highgo=# create database template1 template template0;
CREATE DATABASE
highgo=# UPDATE pg_database SET datistemplate='true' WHERE datname='template1';
UPDATE 1
highgo=# drop database template1;
错误: 42809: 无法删除模板数据库
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
--------------+--------------+----------+------------+------------+-------------------
benchmarksql | benchmarksql | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db0 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db1 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db10 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db100 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
db1000 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
highgo | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 |
template0 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/highgo +
| | | | | highgo=CTc/highgo
template1 | highgo | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/highgo +
| | | | | highgo=CTc/highgo
(9 rows)
highgo=# drop database template1;
错误: 42809: 无法删除模板数据库
highgo=# UPDATE pg_database SET datistemplate='false' WHERE datname='template1';
UPDATE 1
highgo=# drop database template1;
DROP DATABASE
highgo=# create database template1 template template0;
CREATE DATABASE
highgo=# UPDATE pg_database SET datistemplate='true' WHERE datname='template1';
UPDATE 1
highgo=# drop database template1;
错误: 42809: 无法删除模板数据库