Op 07-09-2022 om 21:45 schreef Daniel Gustafsson:
One thing this patchversion currently lacks is refined error messaging, but if
we feel that this approach is a viable path then that can be tweaked. The
function which starts the parser can also be refactored to be shared across
pg_dump, pg_dumpall and pg_restore but I've kept it simple for now.
Thoughts? It would be nice to get this patch across the finishline during this
commitfest.
> [0001-Add-include-exclude-filtering-via-file-in-pg_dump.patch]
This seems to dump & restore well (as Pavels patch does).
I did notice one peculiarity (in your patch) where for each table a few
spaces are omitted by pg_dump.
-------------
#! /bin/bash
psql -qXc "drop database if exists testdb2"
psql -qXc "create database testdb2"
echo "
create schema if not exists test;
create table table0 (id integer);
create table table1 (id integer);
insert into table0 select n from generate_series(1,2) as f(n);
insert into table1 select n from generate_series(1,2) as f(n);
" | psql -qXad testdb2
echo "include table table0" > inputfile1.txt
echo "include table table0
include table table1" > inputfile2.txt
# 1 table, emits 2 spaces
echo -ne ">"
pg_dump -F p -f plainfile1 --filter=inputfile1.txt -d testdb2
echo "<"
# 2 tables, emits 4 space
echo -ne ">"
pg_dump -F p -f plainfile2 --filter=inputfile2.txt -d testdb2
echo "<"
# dump without filter emits no spaces
echo -ne ">"
pg_dump -F c -f plainfile3 -t table0 -table1 -d testdb2
echo "<"
-------------
It's probably a small thing -- but I didn't find it.
thanks,
Erik Rijkers
--
Daniel Gustafsson https://vmware.com/