noblobs_v5.patch
text/x-patch
Filename: noblobs_v5.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
Series: patch v5
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/pg_dump.sgml | 15 | 0 |
| src/bin/pg_dump/pg_backup_archiver.c | 1 | 0 |
| src/bin/pg_dump/pg_dump.c | 8 | 2 |
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 371a614..fb69d6d 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -145,6 +145,21 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>-B</></term>
+ <term><option>--no-blobs</></term>
+ <listitem>
+ <para>
+ Exclude large objects in the dump.
+ </para>
+
+ <para>
+ When both <option>-b</> and <option>-B</> are given, the behavior
+ is dependent on which option is last on the command line.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-c</option></term>
<term><option>--clean</option></term>
<listitem>
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 0e20985..f90c074 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -137,6 +137,7 @@ InitDumpOptions(DumpOptions *opts)
{
memset(opts, 0, sizeof(DumpOptions));
/* set any fields that shouldn't default to zeroes */
+ opts->outputBlobs = true;
opts->include_everything = true;
opts->dumpSections = DUMP_UNSECTIONED;
}
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4da297f..4d3e245 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -291,6 +291,7 @@ main(int argc, char **argv)
static struct option long_options[] = {
{"data-only", no_argument, NULL, 'a'},
{"blobs", no_argument, NULL, 'b'},
+ {"no-blobs", no_argument, NULL, 'B'},
{"clean", no_argument, NULL, 'c'},
{"create", no_argument, NULL, 'C'},
{"dbname", required_argument, NULL, 'd'},
@@ -379,7 +380,7 @@ main(int argc, char **argv)
InitDumpOptions(&dopt);
- while ((c = getopt_long(argc, argv, "abcCd:E:f:F:h:j:n:N:oOp:RsS:t:T:U:vwWxZ:",
+ while ((c = getopt_long(argc, argv, "abBcCd:E:f:F:h:j:n:N:oOp:RsS:t:T:U:vwWxZ:",
long_options, &optindex)) != -1)
{
switch (c)
@@ -392,6 +393,10 @@ main(int argc, char **argv)
dopt.outputBlobs = true;
break;
+ case 'B': /* Don't dump blobs */
+ dopt.outputBlobs = false;
+ break;
+
case 'c': /* clean (i.e., drop) schema prior to create */
dopt.outputClean = 1;
break;
@@ -708,7 +713,7 @@ main(int argc, char **argv)
* 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.
*/
- if (dopt.include_everything && !dopt.schemaOnly)
+ if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
dopt.outputBlobs = true;
/*
@@ -864,6 +869,7 @@ help(const char *progname)
printf(_("\nOptions controlling the output content:\n"));
printf(_(" -a, --data-only dump only the data, not the schema\n"));
printf(_(" -b, --blobs include large objects in dump\n"));
+ printf(_(" -B, --no-blobs exclude large objects in dump\n"));
printf(_(" -c, --clean clean (drop) database objects before recreating\n"));
printf(_(" -C, --create include commands to create database in dump\n"));
printf(_(" -E, --encoding=ENCODING dump the data in encoding ENCODING\n"));