I have a PostgreSQL plain format dump and need only two or three tables' data. The dump is in gz2 format.
bzcat dump.sql.gz | perl -lne 'print if /^COPY tablename/../^\\\.$/' > something.sql
not working. also tried
bzip2 -dc dump.sql.gz|perl -lne 'print if /^COPY tablename/../^\\\.$/' > something.sql
The dump file is more than 30GB.
The table name probably needs to be schema-qualified.
This will depend on the version of pg_dump being used. The change actually kicks in in a bug-fix release, is it was the result of a security concern (CVE-2018-1058)