pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump -s -b
3+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2016-11-29 b57c8333b5 d722927e1f 6c1a257fc6 be0b98fc21 eacdd5d7b0 f45719997d  Clarify pg_dump -b documentation
* pg_dump -s -b
@ 2016-11-19 17:08  Stephen Frost <sfrost@snowman.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Stephen Frost @ 2016-11-19 17:08 UTC (permalink / raw)
  To: pgsql-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:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_dump -s -b
@ 2016-11-19 17:20  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Stephen Frost <sfrost@snowman.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2016-11-19 17:20 UTC (permalink / raw)
  To: Stephen Frost <sfrost@snowman.net>; +Cc: pgsql-hackers

Stephen Frost <sfrost@snowman.net> writes:
> 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.
> ----

Clearly, this is an oversimplification.

> 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.

IMO, blobs are data, so those behaviors are correct.  The docs should
be fixed to match the code.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_dump -s -b
@ 2016-11-19 17:33  Stephen Frost <sfrost@snowman.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Stephen Frost @ 2016-11-19 17:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers

* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> IMO, blobs are data, so those behaviors are correct.  The docs should
> be fixed to match the code.

Works for me.

Thoughts on the attached?

Thanks!

Stephen

Attachments:

pg_dump_blobs_doc_fix.patch (text/x-diff, 1.2K) download diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml new file mode 100644 index 371a614..04b3124 *** a/doc/src/sgml/ref/pg_dump.sgml --- b/doc/src/sgml/ref/pg_dump.sgml *************** PostgreSQL documentation *** 138,145 **** <para> Include large objects in the dump. This is the default behavior except when <option>--schema</>, <option>--table</>, or ! <option>--schema-only</> is specified, so the <option>-b</> ! switch is only useful to add large objects to selective dumps. </para> </listitem> </varlistentry> --- 138,148 ---- <para> Include large objects in the dump. This is the default behavior except when <option>--schema</>, <option>--table</>, or ! <option>--schema-only</> is specified. The <option>-b</> ! switch is therefore only useful to add large objects to dumps ! where a specific schema or table has been requested. Note that ! blobs are considered data and therefore will be included when ! --data-only is used, but not when --schema-only is. </para> </listitem> </varlistentry>
signature.asc (application/pgp-signature, 818B) download ^ permalink raw reply [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-11-19 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 17:08 pg_dump -s -b Stephen Frost <sfrost@snowman.net>
2016-11-19 17:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-11-19 17:33   ` Stephen Frost <sfrost@snowman.net>

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