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

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

Reply via email to