PostgreSQL how to create a copy of a database or schema?

If it’s on the same server, you just use the CREATE DATABASE command with the TEMPLATE parameter. For example:

CREATE DATABASE newdb WITH TEMPLATE olddb;

Leave a Comment