Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables) - Mailing list pgsql-hackers

From Greg Sabino Mullane
Subject Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)
Date
Msg-id CAKAnmmLYwUw0Kc4E-aBDeYNU=S+RxRx+CTXgBR6dvERAcUvUYQ@mail.gmail.com
Whole thread Raw
In response to PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)  (Kirk Wolak <wolakk@gmail.com>)
Responses Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)
List pgsql-hackers
I've seen this idea pop up over the years, and it's still a good one. Rather than invent new flags, I think a better approach would be to convince pg_dump to dump a view, such that table foo has a view fooslice to limit / filter the output. Then we can simply do:

pg_dump -t foo=view:fooslice

and under the hood pg_dump would do

COPY (SELECT * FROM fooslice) TO ...
rather than
COPY foo TO ...

While we could make the view mapping into a separate filtering file as you suggest, that's more complexity and also a little more dangerous in an action-at-a-distance way, so I'd rather have people be very specific in the mapping on the command line.

I could swear I made a POC years ago for something like this, but it's long gone. If I get some time, I'll give it a fresh attempt.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: index prefetching
Next
From: Andres Freund
Date:
Subject: Re: Remove Instruction Synchronization Barrier in spin_delay() for ARM64 architecture