From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: scorpy@gmail.com
Subject: pg_restore dbname
Date: Wed, 29 Apr 2020 15:42:13 +0000
Message-ID: <158817493335.671.15980961934499341141@wrigleys.postgresql.org> (raw)
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/11/app-pgrestore.html
Description:
"-C
--create
Create the database before restoring into it. If --clean is also
specified, drop and recreate the target database before connecting to it.
With --create, pg_restore also restores the database's comment if any,
and any configuration variable settings that are specific to this database,
that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ...
SET ... commands that mention this database. Access privileges for the
database itself are also restored, unless --no-acl is specified.
When this option is used, the database named with -d is used only to
issue the initial DROP DATABASE and CREATE DATABASE commands. All data is
restored into the database name that appears in the archive."
I am finding the opposite happening from that final sentence. When I use
--clean and --create, it is using the database name from the archive during
the DROP and CREATE commands, and using the --dbname argument for the actual
data restore. However, do either things make sense? Shouldn't all of these
commands be executed against the provided database name in the command? How
can I take a backup from my production environment and restore it into my
test environment, if the db names are different?
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: pgsql-docs@postgresql.org
Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, scorpy@gmail.com
Subject: Re: pg_restore dbname
In-Reply-To: <158817493335.671.15980961934499341141@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox