pg_restore --no-post-data and --post-data-only

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-08-23T20:30:50Z
Lists: pgsql-hackers

Attachments

Attached is an undocumented patch that allows pg_restore to omit 
post-data items or omit all but post-data items. This has been discussed 
before, and Simon sent in a patch back on 2008, which has bitrotted 
some. I'm not sure why it was dropped at the time, but I think it's time 
to do this. This patch relies on some infrastructure that was added 
since Simon's patch, so it works a bit differently  (and more simply).

So with this patch, the following three sequences should be equivalent:

     pg_restore --no-post-data
     pg_restore --post-data-only

     pg_restore -s --no-post-data
     pg_restore -a
     pg_restore --post-data-only

     pg_restore


This is useful and worth doing on its own, and will also add to the 
usefulness of the pg_dump --exclude-table-data patch in my previous email.

As with that patch, a version that applies to version 9.0 and 8.4 
sources is also attached, for the very eager.

cheers

andrew