public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Kim Heckler <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Database copy
Date: Thu, 3 Jun 2021 13:32:02 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CH2PR07MB72696EB34DE5AD6EA3B1041D863C9@CH2PR07MB7269.namprd07.prod.outlook.com>
References: <CH2PR07MB72696EB34DE5AD6EA3B1041D863C9@CH2PR07MB7269.namprd07.prod.outlook.com>

On Thu, Jun  3, 2021 at 05:01:16PM +0000, Kim Heckler wrote:
> 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 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.

Yes, you can use it as long as you accept its limitations of locking. 
It is used all the time.

-- 
  Bruce Momjian  <[email protected]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Database copy
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox