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?