pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: pgsql-hackers@postgresql.org
Subject: pg_dump -s -b
Date: Sat, 19 Nov 2016 12:08:35 -0500
Message-ID: <20161119170835.GZ13284@tamriel.snowman.net> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

All,

While reviewing and considering the patch to add the --no-blobs option
to pg_dump, which I entirely agree with, I came across our claim that
passing -b to pg_dump would cause blobs to be output, regardless of
other options set.

To wit, our docs specifically say:

----
Include large objects in the dump. This is the default behavior except
when --schema, --table, or --schema-only is specified, so the -b switch
is only useful to add large objects to selective dumps.
----

However, a 'pg_dump -s -b' won't include blobs, which appears to be due
to the masking performed in _tocEntryRequired() whereby we strip the
REQ_DATA out if we are in schema-only mode.

Further, though perhaps less surprising, we don't include blobs when
--section=post-data is set, and only the definition of the blob (but no
data) when --section=pre-data is used.

This appears to go back at least as far as all currently supported
branches.

We have a few options here.  The documentation says 'selective dumps',
which we could infer to mean 'dumps where the user specified a table' or
similar and exclude 'schema-only' from that case.  I don't believe this
was the original intent, given this comment in pg_dump.c:

/*
 * Dumping blobs is now default unless we saw an inclusion switch or -s
 * ... but even if we did see one of these, -b turns it back on.
 */

Given the lack of field complaints about this, I'm pretty tempted to
just adjust that comment and the documentation.  Alternativly, we could
hack things up in a simimlar manner to what was done in a7e5457, and
cause blobs to be dumped even in schema-only mode if -b is passed.

Thoughts?

Thanks!

Stephen

Attachments:

  [application/pgp-signature] signature.asc (818B, ../20161119170835.GZ13284@tamriel.snowman.net/2-signature.asc)
  download

view thread (3+ messages)  latest in thread

Message-ID: <20161119170835.GZ13284@tamriel.snowman.net>
Permalink:  ../20161119170835.GZ13284@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20161119170835.GZ13284@tamriel.snowman.net

 · 

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: sfrost@snowman.net
  Subject: Re: pg_dump -s -b
  In-Reply-To: <20161119170835.GZ13284@tamriel.snowman.net>

* 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