Re: Excluding tables from pg_restore

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Carlos <Carlos(at)pbsinet(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Excluding tables from pg_restore
Date: 2003-06-16 16:56:44
Message-ID: Pine.LNX.4.21.0306161753160.3121-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 16 Jun 2003, Carlos wrote:

> Hi forum,
>
> How can I exclude a few tables from a pg_dump and a pg_restore? I have a
> pg_dump of a database with several hundred tables and I want to restore most
> of these tables into another database hence I want to exclude a couple of
> the tables from the restore. In the man pages, I found the -t option for
> pg_restore but I would have to name several hundreds tables to use this.
>
> Thanks in advance for your response
>

Well, you could write a little wrapper script that took a list of tables to
exclude, listed the tables in an archive, filtered out the ones given to your
wrapper script and ran pg_restore with what was left.

Of course you'll have to take care not to exceed command line lengths which
means you'd have to be prepared for multiple invocations of pg_restore to load
all the table, or use a langauge you can exec pg_restore directly.

--
Nigel J. Andrews

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2003-06-16 17:00:49 Re: RE : full featured alter table?
Previous Message Jan Wieck 2003-06-16 16:56:29 Re: RE : full featured alter table?