Database copy

From: Kim Heckler <kim(dot)heckler(at)nationwide(dot)com>
To: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Database copy
Date: 2021-06-03 17:01:16
Message-ID: CH2PR07MB72696EB34DE5AD6EA3B1041D863C9@CH2PR07MB7269.namprd07.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

All,

I have read in the CREATE DATABASE documentation:

Although it is possible to copy a database other than template1 by specifying its name as the template, this is not (yet) intended as a general-purpose "COPY DATABASE" facility. The principal limitation is that no other sessions can be connected to the template database while it is being copied. CREATE DATABASE will fail if any other connection exists when it starts; otherwise, new connections to the template database are locked out until CREATE DATABASE completes. See Section 22.3<https://www.postgresql.org/docs/12/manage-ag-templatedbs.html> for more information.

Can I safely use this on a regular basis to copy a database within the same instance/server? If not, I'll use pg_dump and pg_restore to complete the ask.

Thank you.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2021-06-03 17:32:02 Re: Database copy
Previous Message Pól Ua Laoínecháin 2021-06-02 15:18:40 Re: Scripting with subdirectories - how to specify script locations.