

You can view which databases in PostgreSQL are your templates with the following command - pay attention to datistemplate that specifies whether the database is a template or not: SELECT datname, datallowconn, datistemplate FROM pg_database The name "template" is exactly what it the database is: it's a template for new databases. Two of these are called "template0" and "template1" and are referred to in the PostgreSQL documentation as template databases. Creating a Database and template1Īs we mentioned, when a PostgreSQL cluster is provisioned you'll be given three databases - or four if using Compose. While you might be familiar with the empty "postgres" database, what's the use of template databases? In this PostgreSQL Tips, we'll take a look at these template databases and show you what they're there for, and how you might use them in in your PostgreSQL deployment. If you use Compose, you'll get another database called "compose". When setting up PostgreSQL, whether you're using PostgreSQL locally or in the cloud, you get three standard databases outside the box: "template0", "template1", and "postgres". In this article, we'll cover the databases you get when you create a PostgreSQL deployment: template databases.
#Postgres create database how to#
So, we decided to launch a series called PostgreSQL Tips to level up your knowledge about the database and to give you tips on how to use it. We get a lot of customers asking us numerous questions about PostgreSQL.

PostgreSQL Tips: Template Databases postgresql postgresql tips Free 30 Day Trial
