3

I'm using psql 13.4 to make a pg_dump of a database. I need only the schema (no data) for all tables except one enumerated reference table, for which I need the data. I see that pg_dump has an --exclude-table-data flag that supports regex patterns. But it does not have an --include-table-data flag.

So to exclude table data for all tables except the single reference table, I thought I could use a regex with negative look ahead. For example this one: ^(?!.*(reference_table_name)). However this doesn't seem to work due to psql's special character limitations (e.g. on *, ?, and .) described here. I've tried to make the substitutions it suggests but it doesn't work.

Is what I'm trying to do even possible?

1 Answers1

1

I also tried to exclude data from tables in the dump except one using the --exclude-table-data parameter with different variants of the regular expression, but as you point to the restriction with the ? character, it seems even according to https://stackoverflow.com/a/29232803/2754392 that this is not possible.