template1 에 오브젝트 생성하면 이후 create database 시 초기 오브젝트에 포함되어 생성되는 것을 보면 알 수 있습니다.
template0 은 postgreSQL의 초기 데이터베이스 템플릿입니다.
sk1=# \l+
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+------------------------------------
sk1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 42 MB | pg_default |
sk2 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 8801 kB | pg_default |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 8617 kB | pg_default | unmodifiable empty database
| | | | | postgres=CTc/postgres | | |
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 8769 kB | pg_default | default template for new databases
| | | | | postgres=CTc/postgres | | |
(4 rows)
template1은 초기 생성(initdb) 시 지정한 인코딩 및 로케일(locale)에 관한 데이터를 포함하지만 template0은 그렇지 않습니다.
CREATE DATABASE sk2 WITH template=template0 ENCODING = 'UTF8' locale='C';
댓글
댓글 쓰기