Hi,

2016-11-03 8:22 GMT+01:00 amul sul <sula...@gmail.com>:

> Hi Guillaume,
>
> With your v2 patch, -B options working as expected but --no-blobs
> options is still unrecognized, this happens is because of you have
> forgot to add entry for 'no-blobs' in long_options[] array.
>
>
You're right. v3 (attached) fixes this.


> Apart from this concern patch looks good to me. Thanks
>
>
Thanks.


> Regards,
> Amul
>
> The new status of this patch is: Waiting on Author
>
> On Mon, Oct 24, 2016 at 12:19 AM, Guillaume Lelarge
> <guilla...@lelarge.info> wrote:
> > 2016-10-23 20:44 GMT+02:00 Guillaume Lelarge <guilla...@lelarge.info>:
> >>
> >> 2016-10-23 20:37 GMT+02:00 Andreas Joseph Krogh <andr...@visena.com>:
> >>>
> >>> På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh
> >>> <andr...@visena.com>:
> >>>
> >>> På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge
> >>> <guilla...@lelarge.info>:
> >>>
> >>> 2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andr...@visena.com>:
> >>>>
> >>>> På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston
> >>>> <david.g.johns...@gmail.com>:
> >>>>
> >>>> On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh
> >>>> <andr...@visena.com> wrote:
> >>>>>
> >>>>> På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake
> >>>>> <j...@commandprompt.com>:
> >>>>>
> >>>>> On 03/08/2016 08:02 AM, Andreas Joseph Krogh wrote:
> >>>>> > På tirsdag 08. mars 2016 kl. 16:57:01, skrev Tom Lane
> >>>>> > <t...@sss.pgh.pa.us
> >>>>> > <mailto:t...@sss.pgh.pa.us>>:
> >>>>> >
> >>>>> >     Andreas Joseph Krogh <andr...@visena.com> writes:
> >>>>> >      > What I'm looking for is "inverse -b" in an otherwise
> complete
> >>>>> >     dump. Any plans
> >>>>> >      > to add that?
> >>>>> >
> >>>>> >     [ shrug... ]  Nobody ever asked for it before.
> >>>>> >
> >>>>> >     regards, tom lane
> >>>>> >
> >>>>> > It surely helps testing production-datasets which contain lots of
> >>>>> > BLOBs
> >>>>> > where one wants to dump the production-data into a test-env. We
> have
> >>>>> >  >1TB databases containing > 95% blobs so it would help us
> >>>>> > tremendously
> >>>>> > to have this option.
> >>>>>
> >>>>> I have quite a few customers that would benefit from the ability to
> not
> >>>>> have blobs present in dumps.
> >>>>>
> >>>>>
> >>>>> Great! So how do we proceed to get "--no-blobs" added to pg_dump?
> >>>>> Maybe CommandPrompt and Visena should co-fund development of such an
> >>>>> addition, if it's accepted by -hackers?
> >>>>> We'd be willing to pay for such an addition for the 9.5 branch, as a
> >>>>> patch.
> >>>>
> >>>>
> >>>> Unfortunately this doesn't qualify as a bug fix - it is a new feature
> >>>> and thus is ineligible for inclusion in official 9.5
> >>>>
> >>>> David J.
> >>>>
> >>>>
> >>>> Of course. That's why I mentioned that, if possible, an unofficial
> patch
> >>>> to 9.5 could be developed, funded partly by Visena (my company).
> Given that
> >>>> someone is willing to do this of course.
> >>>>
> >>>
> >>>
> >>> That probably should look like the patch attached. It applies cleanly
> on
> >>> HEAD, and works AFAICT. If this patch seems interesting enough, I'll
> add it
> >>> to the next commit fest (note for myself, update the ref/pg_dump.sgml
> >>> documentation file).
> >>>
> >>> For Andreas' information, it also applies on 9.5, though I didn't check
> >>> if it worked afterwards.
> >>>
> >>>
> >>> +1 for adding it to the commitfest.
> >>>
> >>
> >>
> >> Done, https://commitfest.postgresql.org/11/833/
> >>
> >>> It's almost scary how simple this patch is and noone ever got around to
> >>> implement it.
> >>
> >>
> >> Nobody had the time (like me, till now) or the motivation.
> >>
> >>>
> >>>
> >>> Thanks, I'll test it on 9.5 soon.
> >>>
> >>>
> >>> It's totally OK for me to use 9.6 (now that it's released) to dump 9.5
> >>> DBs, so I'm all good with this patch, thanks!
> >>
> >>
> >> Remember that, if it gets commited, it'll be for next release (aka 10),
> >> and not 9.6 and earlier.
> >>
> >
> > New patch, this time with the documentation.
> >
> >
>



-- 
Guillaume.
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 371a614..83dc52f 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -145,6 +145,16 @@ PostgreSQL documentation
      </varlistentry>
 
      <varlistentry>
+      <term><option>-B</></term>
+      <term><option>--no-blobs</></term>
+      <listitem>
+       <para>
+        Exclude large objects in the dump.
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry>
       <term><option>-c</option></term>
       <term><option>--clean</option></term>
       <listitem>
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4da297f..95c6ec7 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.include_everything = false;
+				break;
+
 			case 'c':			/* clean (i.e., drop) schema prior to create */
 				dopt.outputClean = 1;
 				break;
@@ -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"));
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to