Re: Add --include-table-data-where option to pg_dump, to export only a subset of table data

From: Carter Thaxton <carter(dot)thaxton(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add --include-table-data-where option to pg_dump, to export only a subset of table data
Date: 2018-05-23 05:18:32
Message-ID: CAGiT_HORup+a-GxwQdy2CQfhvvU6wEUFzydt5Nja2Zkn6puY-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Ah yes, thanks. I did in fact have colors enabled.
I've attached a new patch generated by `git format-patch`. Hopefully
that's correct.

On Mon, May 21, 2018 at 4:00 PM, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com
> wrote:

> On Tue, May 22, 2018 at 4:05 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> > * Carter Thaxton (carter(dot)thaxton(at)gmail(dot)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
>

Attachment Content-Type Size
pgdump-include-table-data-where-v2.patch application/octet-stream 10.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-05-23 05:42:08 Re: SCRAM with channel binding downgrade attack
Previous Message Carter Thaxton 2018-05-23 04:57:25 Re: Add --include-table-data-where option to pg_dump, to export only a subset of table data