Re: Add --include-table-data-where option to pg_dump, to export onlya subset of table data - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Add --include-table-data-where option to pg_dump, to export onlya subset of table data
Date
Msg-id CAEepm=28jGiCv0x+EmQkuXK-NC_sFSr35skqw7a4BAOfV3HOTw@mail.gmail.com
Whole thread Raw
In response to Re: Add --include-table-data-where option to pg_dump, to export onlya subset of table data  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Add --include-table-data-where option to pg_dump, to export onlya subset of table data  (Carter Thaxton <carter.thaxton@gmail.com>)
List pgsql-hackers
On Tue, May 22, 2018 at 4:05 AM, Stephen Frost <sfrost@snowman.net> wrote:
> * Carter Thaxton (carter.thaxton@gmail.com) wrote:
>>   pg_dump --include-table-data-where=largetable:"created_at >=
>> '2018-05-01'" database_name
>
> I've wanted something similar to this in the past as well, and, as
> you've seen, we have some support for this kind of thing in pg_dump
> already and what you're doing is exposing that.

+1

>> I've prepared a proposed patch for this, which is attached.  The code
>> changes are rather straightforward.  I did have to add the ability to carry
>> around an extra pointer-sized object to the simple_list implementation, in
>> order to allow the filter clause to be associated to the matching oids of
>> the table pattern.  It seemed the best way to augment the existing
>> simple_list implementation, but change as little as possible elsewhere in
>> the codebase.  (Note that SimpleOidList is actually only used by pg_dump).
>>
>> Feel free to review and propose any amendments.
>
> I've only taken a quick look but I don't see any regression tests, for
> starters, and it's not clear if this can be passed multiple times for
> one pg_dump run (I'd certainly hope that it could be...).
>
> Also, if you haven't already, this should be registered on the
> commitfest app, so we don't lose track of it.

Thanks for doing that.  Unfortunately the patch seems to be corrupted
in some way, maybe ANSI control characters or something... perhaps you
set colour.ui = always in your git config, instead of auto?  You might
also consider using git format-patch so you can include a brief commit
message that explains the feature.

-- 
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Carter Thaxton
Date:
Subject: Re: Add --include-table-data-where option to pg_dump, to export onlya subset of table data
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] kqueue