pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Further cleanup of pg_dump/pg_restore item selection code
Date: Wed, 24 Jan 2018 23:17:38 -0500
Message-ID: <4858.1516853858@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZB=-7SL9EMjGSDAb=J13Ed8F372t6U2epYtSn=DX3DKg@mail.gmail.com>
References: <32668.1516848577@sss.pgh.pa.us>
	<CAKFQuwZB=-7SL9EMjGSDAb=J13Ed8F372t6U2epYtSn=DX3DKg@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wednesday, January 24, 2018, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The same behaviors occur if you do e.g.
>> 	pg_dump -Fc -t sometable somedb | pg_restore --create
>> which is another undocumented misbehavior: the docs for pg_restore do not
>> suggest that --create might fail if the source archive was selective.

> pg_restore -t:

> "When -t is specified, pg_restore makes no attempt to restore any other
> database objects that the selected table(s) might depend upon. Therefore,
> there is no guarantee that a specific-table restore into a clean database
> will succeed."

I think you might be missing one of the main points here, which is
that --create is specified as causing both a CREATE DATABASE and a
reconnect to that database.  If it silently becomes a no-op, which
is what happens today, the restore is likely to go into the wrong
database entirely (or at least not the DB the user expected).

I won't deny the possibility that some people are depending on the
existing wrong behavior, but that's a hazard with any bug fix.

			regards, tom lane




view thread (6+ messages)  latest in thread

Message-ID: <4858.1516853858@sss.pgh.pa.us>
Permalink:  ../4858.1516853858@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4858.1516853858@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Further cleanup of pg_dump/pg_restore item selection code
  In-Reply-To: <4858.1516853858@sss.pgh.pa.us>

* 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