Dmitry Koterov <dmitry@koterov.ru> writes:
> Is there any way (or hack) to dump the whole database, but to exclude the
> DATA from a table within this dump? (DDL of the table should not be
> excluded: after restoring the data the excluded table should look "empty".)
The pg_staging tool allows you to do that quite easily, once you've done
the initial setup (involved, but nothing fancy).
https://github.com/dimitri/pg_staging
http://tapoueh.org/pgsql/pgstaging.html
If you want to exclude the table from the dumps though (data loss issues
are looking at you), what I would advice is create a dedicated schema
and skipping the whole schema at dump time, using the following option:
--exclude-schema=schema
Do not dump any schemas matching the schema
pattern. The pattern is interpreted according to the
same rules as for -n. -N can be given more than once
to exclude schemas matching any of several patterns.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support