Thread: Exclude pg_largeobject form pg_dump

Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
Hi all.
 
Is there a way to exclude pg_largeobject from pg_dump? -T pg_largeobject doesn't work. I've tried to exclude tables using OID-datatype also but that didn't work either.
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Adrian Klaver
Date:
On 03/08/2016 01:53 AM, Andreas Joseph Krogh wrote:
> Hi all.
> Is there a way to exclude pg_largeobject from pg_dump? -T pg_largeobject
> doesn't work. I've tried to exclude tables using OID-datatype also but
> that didn't work either.

Well pg_largeobject is a system catalog so pretty sure it cannot be
excluded.

What tables are you trying to exclude with OID?

Do you care about not dumping the pg_largeobject table or not dumping
the data it contains?

> Thanks.
> --
> *Andreas Joseph Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas@visena.com <mailto:andreas@visena.com>
> www.visena.com <https://www.visena.com>
> <https://www.visena.com>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 15:43:37, skrev Adrian Klaver <adrian.klaver@aklaver.com>:
On 03/08/2016 01:53 AM, Andreas Joseph Krogh wrote:
> Hi all.
> Is there a way to exclude pg_largeobject from pg_dump? -T pg_largeobject
> doesn't work. I've tried to exclude tables using OID-datatype also but
> that didn't work either.

Well pg_largeobject is a system catalog so pretty sure it cannot be
excluded.

What tables are you trying to exclude with OID?

Do you care about not dumping the pg_largeobject table or not dumping
the data it contains?
 
I have several tables with OID-columns and I'd like to dump my DB without any data in pg_largeobject (> 95% of the space is occupied by data in pg_largeobject).
I've tried to exclude (using -T) the tables containing OID-columns but pg_largeobject is still dumped containing the data it seems.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Tom Lane
Date:
Andreas Joseph Krogh <andreas@visena.com> writes:
> På tirsdag 08. mars 2016 kl. 15:43:37, skrev Adrian Klaver <
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>  Do you care about not dumping the pg_largeobject table or not dumping
>  the data it contains?
>
> I have several tables with OID-columns and I'd like to dump my DB without any
> data in pg_largeobject (> 95% of the space is occupied by data in
> pg_largeobject).
> I've tried to exclude (using -T) the tables containing OID-columns but
> pg_largeobject is still dumped containing the data it seems.

A look at the pg_dump source code says that it skips blobs if any of
-s, -n, -t are used.  There's a -b switch to undo that and include
them anyway, but no "inverse -b" to skip them in an otherwise-complete
dump.

So you could do something along the lines of pg_dump -t '*' ...
although this will result in *all* non-schema-named objects being
excluded, I believe, which might be a problem.

            regards, tom lane


Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 16:30:36, skrev Tom Lane <tgl@sss.pgh.pa.us>:
Andreas Joseph Krogh <andreas@visena.com> writes:
> P�� tirsdag 08. mars 2016 kl. 15:43:37, skrev Adrian Klaver <
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>  Do you care about not dumping the pg_largeobject table or not dumping
>  the data it contains?
>
> I have several tables with OID-columns and I'd like to dump my DB without any
> data in pg_largeobject (> 95% of the space is occupied by data in
> pg_largeobject).
> I've tried to exclude (using -T) the tables containing OID-columns but
> pg_largeobject is still dumped containing the data it seems.

A look at the pg_dump source code says that it skips blobs if any of
-s, -n, -t are used.  There's a -b switch to undo that and include
them anyway, but no "inverse -b" to skip them in an otherwise-complete
dump.

So you could do something along the lines of pg_dump -t '*' ...
although this will result in *all* non-schema-named objects being
excluded, I believe, which might be a problem.

regards, tom lane
 
Hm:
 
pg_dump -v -t '*' > andreak-noblob.dmp
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: [archiver (db)] query failed: ERROR:  permission denied for relation pg_authid
pg_dump: [archiver (db)] query was: LOCK TABLE pg_catalog.pg_authid IN ACCESS SHARE MODE
 
 
What I'm looking for is "inverse -b" in an otherwise complete dump. Any plans to add that?
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Adrian Klaver
Date:
On 03/08/2016 07:46 AM, Andreas Joseph Krogh wrote:
> På tirsdag 08. mars 2016 kl. 16:30:36, skrev Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@visena.com> writes:
>      > P�� tirsdag 08. mars 2016 kl. 15:43:37, skrev Adrian Klaver <
>      > adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>      >  Do you care about not dumping the pg_largeobject table or not
>     dumping
>      >  the data it contains?
>      >
>      > I have several tables with OID-columns and I'd like to dump my DB
>     without any
>      > data in pg_largeobject (> 95% of the space is occupied by data in
>      > pg_largeobject).
>      > I've tried to exclude (using -T) the tables containing
>     OID-columns but
>      > pg_largeobject is still dumped containing the data it seems.
>
>     A look at the pg_dump source code says that it skips blobs if any of
>     -s, -n, -t are used.  There's a -b switch to undo that and include
>     them anyway, but no "inverse -b" to skip them in an otherwise-complete
>     dump.
>
>     So you could do something along the lines of pg_dump -t '*' ...
>     although this will result in *all* non-schema-named objects being
>     excluded, I believe, which might be a problem.
>
>     regards, tom lane
>
> Hm:
> pg_dump -v -t '*' > andreak-noblob.dmp
> pg_dump: reading extensions
> pg_dump: identifying extension members
> pg_dump: reading schemas
> pg_dump: reading user-defined tables
> pg_dump: [archiver (db)] query failed: ERROR:  permission denied for
> relation pg_authid


Off hand I would say you are running pg_dump as a user that is not a
superuser:

aklaver@panda:~> pg_dump -v -d test -U aklaver -t '*'
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: [archiver (db)] query failed: ERROR:  permission denied for
relation pg_authid
pg_dump: [archiver (db)] query was: LOCK TABLE pg_catalog.pg_authid IN
ACCESS SHARE MODE


aklaver@panda:~> pg_dump -v -d test -U postgres -t '*'
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
....


> pg_dump: [archiver (db)] query was: LOCK TABLE pg_catalog.pg_authid IN
> ACCESS SHARE MODE
> What I'm looking for is "inverse -b" in an otherwise complete dump. Any
> plans to add that?
> --
> *Andreas Joseph Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas@visena.com <mailto:andreas@visena.com>
> www.visena.com <https://www.visena.com>
> <https://www.visena.com>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Exclude pg_largeobject form pg_dump

From
Tom Lane
Date:
Andreas Joseph Krogh <andreas@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


Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 16:54:19, skrev Adrian Klaver <adrian.klaver@aklaver.com>:
On 03/08/2016 07:46 AM, Andreas Joseph Krogh wrote:
> På tirsdag 08. mars 2016 kl. 16:30:36, skrev Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@visena.com> writes:
>      > P�� tirsdag 08. mars 2016 kl. 15:43:37, skrev Adrian Klaver <
>      > adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>      >  Do you care about not dumping the pg_largeobject table or not
>     dumping
>      >  the data it contains?
>      >
>      > I have several tables with OID-columns and I'd like to dump my DB
>     without any
>      > data in pg_largeobject (> 95% of the space is occupied by data in
>      > pg_largeobject).
>      > I've tried to exclude (using -T) the tables containing
>     OID-columns but
>      > pg_largeobject is still dumped containing the data it seems.
>
>     A look at the pg_dump source code says that it skips blobs if any of
>     -s, -n, -t are used.  There's a -b switch to undo that and include
>     them anyway, but no "inverse -b" to skip them in an otherwise-complete
>     dump.
>
>     So you could do something along the lines of pg_dump -t '*' ...
>     although this will result in *all* non-schema-named objects being
>     excluded, I believe, which might be a problem.
>
>     regards, tom lane
>
> Hm:
> pg_dump -v -t '*' > andreak-noblob.dmp
> pg_dump: reading extensions
> pg_dump: identifying extension members
> pg_dump: reading schemas
> pg_dump: reading user-defined tables
> pg_dump: [archiver (db)] query failed: ERROR:  permission denied for
> relation pg_authid


Off hand I would say you are running pg_dump as a user that is not a
superuser:
[snip]
 
Yes, since when should I not be able to dump a DB (owned by a non-superuser) as that user?
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 16:57:01, skrev Tom Lane <tgl@sss.pgh.pa.us>:
Andreas Joseph Krogh <andreas@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.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Melvin Davidson
Date:


On Tue, Mar 8, 2016 at 11:02 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 16:57:01, skrev Tom Lane <tgl@sss.pgh.pa.us>:
Andreas Joseph Krogh <andreas@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.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
 

Probably you need to redesign the schema.

Move the blobs to a new/separate child table. Then you can exclude them.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Attachment

Re: Exclude pg_largeobject form pg_dump

From
Tom Lane
Date:
Andreas Joseph Krogh <andreas@visena.com> writes:
> På tirsdag 08. mars 2016 kl. 16:54:19, skrev Adrian Klaver <
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>  Off hand I would say you are running pg_dump as a user that is not a
>  superuser:

> Yes, since when should I not be able to dump a DB (owned by a non-superuser)
> as that user?

The problem is that -t '*' is being interpreted as matching system
catalogs.  You might be able to get somewhere with

pg_dump -t '*' -N pg_catalog ...

Probably we should fix pg_dump so it doesn't try to dump system catalogs
as tables, even if the switches seem to ask it to.

            regards, tom lane


Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 17:10:43, skrev Tom Lane <tgl@sss.pgh.pa.us>:
Andreas Joseph Krogh <andreas@visena.com> writes:
> P�� tirsdag 08. mars 2016 kl. 16:54:19, skrev Adrian Klaver <
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>  Off hand I would say you are running pg_dump as a user that is not a
>  superuser:

> Yes, since when should I not be able to dump a DB (owned by a non-superuser)
> as that user?

The problem is that -t '*' is being interpreted as matching system
catalogs.  You might be able to get somewhere with

pg_dump -t '*' -N pg_catalog ...

Probably we should fix pg_dump so it doesn't try to dump system catalogs
as tables, even if the switches seem to ask it to.

regards, tom lane
 
That didn't work either:
pg_dump -t '*' -N pg_catalog
pg_dump: [archiver (db)] query failed: ERROR:  permission denied for relation pg_authid
pg_dump: [archiver (db)] query was: LOCK TABLE pg_catalog.pg_authid IN ACCESS SHARE MODE
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
"Joshua D. Drake"
Date:
On 03/08/2016 08:02 AM, Andreas Joseph Krogh wrote:
> På tirsdag 08. mars 2016 kl. 16:57:01, skrev Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.

JD


--
Command Prompt, Inc.                  http://the.postgres.company/
                         +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.


Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
"David G. Johnston"
Date:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.


--
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge <guillaume@lelarge.info>:
2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 
It's almost scary how simple this patch is and noone ever got around to implement it.
 
Thanks, I'll test it on 9.5 soon.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh <andreas@visena.com>:
På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge <guillaume@lelarge.info>:
2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 
It's almost scary how simple this patch is and noone ever got around to implement it.
 
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!
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-10-23 20:37 GMT+02:00 Andreas Joseph Krogh <andreas@visena.com>:
På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh <andreas@visena.com>:
På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge <guillaume@lelarge.info>:
2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 

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.


--

Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-10-23 20:44 GMT+02:00 Guillaume Lelarge <guillaume@lelarge.info>:
2016-10-23 20:37 GMT+02:00 Andreas Joseph Krogh <andreas@visena.com>:
På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh <andreas@visena.com>:
På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge <guillaume@lelarge.info>:
2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston <david.g.johnston@gmail.com>:
On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake <jd@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 <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>>:
>
>     Andreas Joseph Krogh <andreas@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.
 

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.


--
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På søndag 23. oktober 2016 kl. 20:44:34, skrev Guillaume Lelarge <guillaume@lelarge.info>:
[snip]
Remember that, if it gets commited, it'll be for next release (aka 10), and not 9.6 and earlier.
 
The patch working for 9.6 is fine for me, but getting this in master is of course the best.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

Re: Exclude pg_largeobject form pg_dump

From
amul sul
Date:
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.

Apart from this concern patch looks good to me. Thanks

Regards,
Amul

The new status of this patch is: Waiting on Author

On Mon, Oct 24, 2016 at 12:19 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> 2016-10-23 20:44 GMT+02:00 Guillaume Lelarge <guillaume@lelarge.info>:
>>
>> 2016-10-23 20:37 GMT+02:00 Andreas Joseph Krogh <andreas@visena.com>:
>>>
>>> På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh
>>> <andreas@visena.com>:
>>>
>>> På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge
>>> <guillaume@lelarge.info>:
>>>
>>> 2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
>>>>
>>>> På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston
>>>> <david.g.johnston@gmail.com>:
>>>>
>>>> On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh
>>>> <andreas@visena.com> wrote:
>>>>>
>>>>> På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake
>>>>> <jd@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
>>>>> > <tgl@sss.pgh.pa.us
>>>>> > <mailto:tgl@sss.pgh.pa.us>>:
>>>>> >
>>>>> >     Andreas Joseph Krogh <andreas@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
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
Hi,

2016-11-03 8:22 GMT+01:00 amul sul <sulamul@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
<guillaume@lelarge.info> wrote:
> 2016-10-23 20:44 GMT+02:00 Guillaume Lelarge <guillaume@lelarge.info>:
>>
>> 2016-10-23 20:37 GMT+02:00 Andreas Joseph Krogh <andreas@visena.com>:
>>>
>>> På søndag 23. oktober 2016 kl. 19:15:17, skrev Andreas Joseph Krogh
>>> <andreas@visena.com>:
>>>
>>> På søndag 23. oktober 2016 kl. 17:06:57, skrev Guillaume Lelarge
>>> <guillaume@lelarge.info>:
>>>
>>> 2016-03-08 21:06 GMT+01:00 Andreas Joseph Krogh <andreas@visena.com>:
>>>>
>>>> På tirsdag 08. mars 2016 kl. 21:03:01, skrev David G. Johnston
>>>> <david.g.johnston@gmail.com>:
>>>>
>>>> On Tue, Mar 8, 2016 at 9:45 AM, Andreas Joseph Krogh
>>>> <andreas@visena.com> wrote:
>>>>>
>>>>> På tirsdag 08. mars 2016 kl. 17:38:04, skrev Joshua D. Drake
>>>>> <jd@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
>>>>> > <tgl@sss.pgh.pa.us
>>>>> > <mailto:tgl@sss.pgh.pa.us>>:
>>>>> >
>>>>> >     Andreas Joseph Krogh <andreas@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.
>
>



--
Attachment

Re: Exclude pg_largeobject form pg_dump

From
amul sul
Date:
Hi Guillaume,

I found following issues with this patch, sorry missed in previous post:

#1 :
 43 @@ -392,6 +393,10 @@ main(int argc, char **argv)
 44                 dopt.outputBlobs = true;
 45                 break;
 46
 47 +           case 'B':           /* Don't dump blobs */
 48 +               dopt.include_everything = false;
 49 +               break;
 50 +

Touching dopt.include_everything flag does not seems to be a good idea
for '--no-blobs' option, our intension is to exclude blob only, but
this excluds other dump too (e.g COMMENT ON DATABASE, CREATE
EXTENSION, COMMENT ON EXTENSION, .., etc)  that what we don't want,
right?

#2 :
We should add note for default behaviour if --no-blobs & --blobs both
are specified.

Regards,
Amul Sul


Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
Hi Amul,

2016-11-04 7:52 GMT+01:00 amul sul <sulamul@gmail.com>:
Hi Guillaume,

I found following issues with this patch, sorry missed in previous post:


You don't have to be sorry for me doing shitty things :)
 
#1 :
 43 @@ -392,6 +393,10 @@ main(int argc, char **argv)
 44                 dopt.outputBlobs = true;
 45                 break;
 46
 47 +           case 'B':           /* Don't dump blobs */
 48 +               dopt.include_everything = false;
 49 +               break;
 50 +

Touching dopt.include_everything flag does not seems to be a good idea
for '--no-blobs' option, our intension is to exclude blob only, but
this excluds other dump too (e.g COMMENT ON DATABASE, CREATE
EXTENSION, COMMENT ON EXTENSION, .., etc)  that what we don't want,
right?


Agreed. I was afraid of that, but for some reason, didn't find that. I'll fix this.
 
#2 :
We should add note for default behaviour if --no-blobs & --blobs both
are specified.


Right. I don't know how I will handle this, but you're right that the behaviour should be specified. I'll also fix this.

I'll try to work on this today but as I'm in pgconf.eu 2016, it may be only for tomorrow.

Thank you.


--

Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-11-04 9:35 GMT+01:00 Guillaume Lelarge <guillaume@lelarge.info>:
Hi Amul,

2016-11-04 7:52 GMT+01:00 amul sul <sulamul@gmail.com>:
Hi Guillaume,

I found following issues with this patch, sorry missed in previous post:


You don't have to be sorry for me doing shitty things :)
 
#1 :
 43 @@ -392,6 +393,10 @@ main(int argc, char **argv)
 44                 dopt.outputBlobs = true;
 45                 break;
 46
 47 +           case 'B':           /* Don't dump blobs */
 48 +               dopt.include_everything = false;
 49 +               break;
 50 +

Touching dopt.include_everything flag does not seems to be a good idea
for '--no-blobs' option, our intension is to exclude blob only, but
this excluds other dump too (e.g COMMENT ON DATABASE, CREATE
EXTENSION, COMMENT ON EXTENSION, .., etc)  that what we don't want,
right?


Agreed. I was afraid of that, but for some reason, didn't find that. I'll fix this.

Fixed in v4.
 
 
#2 :
We should add note for default behaviour if --no-blobs & --blobs both
are specified.


Right. I don't know how I will handle this, but you're right that the behaviour should be specified. I'll also fix this.


I checked other options, such as --format, and there's nothing noted as a default behaviour. Last one wins, which is what this patch does.
 
I'll try to work on this today but as I'm in pgconf.eu 2016, it may be only for tomorrow.


It tooks me more time than expected. v4 attached.


--
Attachment

Re: Exclude pg_largeobject form pg_dump

From
amul sul
Date:
On Mon, Nov 7, 2016 at 2:03 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
>>
>> Agreed. I was afraid of that, but for some reason, didn't find that. I'll
>> fix this.
>
>
> Fixed in v4.
>

This fix is broken.

 70  -   if (dopt.include_everything && !dopt.schemaOnly)
 71 +   if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
 72         dopt.outputBlobs = true;

dopt.outputBlobs set to FALSE when option -B is specified and this IF
condition reverts to TRUE which force to dump blobs.

>>
>>
>>>
>>> #2 :
>>> We should add note for default behaviour if --no-blobs & --blobs both
>>> are specified.
>>>
>>
>> Right. I don't know how I will handle this, but you're right that the
>> behaviour should be specified. I'll also fix this.
>>
>
> I checked other options, such as --format, and there's nothing noted as a
> default behaviour. Last one wins, which is what this patch does.
>

Such note exists for --table & --exclude-table option, see following
lines in pg_dump.sgml

 569        <para>
 570         When both <option>-t</> and <option>-T</> are given, the behavior
 571         is to dump just the tables that match at least one <option>-t</>
 572         switch but no <option>-T</> switches.  If <option>-T</> appears
 573         without <option>-t</>, then tables matching <option>-T</> are
 574         excluded from what is otherwise a normal dump.
 575        </para>
 576       </listitem>

Regards,
Amul Sul


Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-11-07 7:06 GMT+01:00 amul sul <sulamul@gmail.com>:
On Mon, Nov 7, 2016 at 2:03 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
>>
>> Agreed. I was afraid of that, but for some reason, didn't find that. I'll
>> fix this.
>
>
> Fixed in v4.
>

This fix is broken.

 70  -   if (dopt.include_everything && !dopt.schemaOnly)
 71 +   if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
 72         dopt.outputBlobs = true;

dopt.outputBlobs set to FALSE when option -B is specified and this IF
condition reverts to TRUE which force to dump blobs.


I don't see what you mean. It forces dump of Blobs if we didn't use -B and if we include everything in the dump, which seems good to me. What did you try that didn't work as expected?

>>
>>
>>>
>>> #2 :
>>> We should add note for default behaviour if --no-blobs & --blobs both
>>> are specified.
>>>
>>
>> Right. I don't know how I will handle this, but you're right that the
>> behaviour should be specified. I'll also fix this.
>>
>
> I checked other options, such as --format, and there's nothing noted as a
> default behaviour. Last one wins, which is what this patch does.
>

Such note exists for --table & --exclude-table option, see following
lines in pg_dump.sgml

 569        <para>
 570         When both <option>-t</> and <option>-T</> are given, the behavior
 571         is to dump just the tables that match at least one <option>-t</>
 572         switch but no <option>-T</> switches.  If <option>-T</> appears
 573         without <option>-t</>, then tables matching <option>-T</> are
 574         excluded from what is otherwise a normal dump.
 575        </para>
 576       </listitem>


You're right on this. v5 fixes this.


--
Attachment

Re: Exclude pg_largeobject form pg_dump

From
Andreas Joseph Krogh
Date:
På mandag 07. november 2016 kl. 22:01:41, skrev Guillaume Lelarge <guillaume@lelarge.info>:
2016-11-07 7:06 GMT+01:00 amul sul <sulamul@gmail.com>:
On Mon, Nov 7, 2016 at 2:03 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
>>
>> Agreed. I was afraid of that, but for some reason, didn't find that. I'll
>> fix this.
>
>
> Fixed in v4.
>


This fix is broken.

 70  -   if (dopt.include_everything && !dopt.schemaOnly)
 71 +   if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
 72         dopt.outputBlobs = true;

dopt.outputBlobs set to FALSE when option -B is specified and this IF
condition reverts to TRUE which force to dump blobs.
 
 
I don't see what you mean. It forces dump of Blobs if we didn't use -B and if we include everything in the dump, which seems good to me. What did you try that didn't work as expected?
 
I guess what he means is that if -B is given, the following code sets dopt.outputBlobs = false
 
+            case 'B':            /* Don't dump blobs */
+                dopt.outputBlobs = false;
+                break;
 
 
Then this IF sets it back to TRUE:
 
+    if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
         dopt.outputBlobs = true;
 
 
...making it impossible to turn off dumping of blobs.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

Re: Exclude pg_largeobject form pg_dump

From
amul sul
Date:
On Tue, Nov 8, 2016 at 5:36 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
>
>
> I don't see what you mean. It forces dump of Blobs if we didn't use -B and
> if we include everything in the dump, which seems good to me. What did you
> try that didn't work as expected?
>
>
> I guess what he means is that if -B is given, the following code sets
> dopt.outputBlobs = false
>
> +            case 'B':            /* Don't dump blobs */
> +                dopt.outputBlobs = false;
> +                break;
>
>
> Then this IF sets it back to TRUE:
>
> +    if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
>          dopt.outputBlobs = true;
>
>
> ...making it impossible to turn off dumping of blobs.
>

Yes, thats the reason v4 patch  was not as expected.

Regards,
Amul Sul


Re: Exclude pg_largeobject form pg_dump

From
Guillaume Lelarge
Date:
2016-11-08 6:01 GMT+01:00 amul sul <sulamul@gmail.com>:
On Tue, Nov 8, 2016 at 5:36 AM, Andreas Joseph Krogh <andreas@visena.com> wrote:
>
>
> I don't see what you mean. It forces dump of Blobs if we didn't use -B and
> if we include everything in the dump, which seems good to me. What did you
> try that didn't work as expected?
>
>
> I guess what he means is that if -B is given, the following code sets
> dopt.outputBlobs = false
>
> +            case 'B':            /* Don't dump blobs */
> +                dopt.outputBlobs = false;
> +                break;
>
>
> Then this IF sets it back to TRUE:
>
> +    if (dopt.include_everything && !dopt.schemaOnly && !dopt.outputBlobs)
>          dopt.outputBlobs = true;
>
>
> ...making it impossible to turn off dumping of blobs.
>

Yes, thats the reason v4 patch  was not as expected.


It took me some time but I finally understand.

Behaviour fix in v6.


--
Attachment