Help Center/
Relational Database Service/
Best Practices/
RDS for PostgreSQL/
Creating Databases/
CREATE DATABASE Options/
TEMPLATE Option
Updated on 2024-09-06 GMT+08:00
TEMPLATE Option
RDS for PostgreSQL provides two default templates for you to create a database: template0 and template1. Their differences are as follows:
- When template1 is used, the character set or collation defined in this template cannot be changed. For details, see Configuring the Collation of a Database in a Locale.
CREATE DATABASE my_db WITH TEMPLATE template1 ;
- When template0 is used, you can change the character set and collation. For details, see Configuring the Collation of a Database in a Locale.
CREATE DATABASE my_db WITH ENCODING = 'UTF8' LC_COLLATE ='zh_CN.utf8' LC_CTYPE ='zh_CN.utf8' TEMPLATE = template0 ;
- If no template is specified during database creation, template1 is used by default. You can also specify a custom template to create a database.
CREATE DATABASE my_db WITH TEMPLATE = mytemplate;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot