Re: Independent backups of subdatabases

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Independent backups of subdatabases
Date: 2013-01-16 14:21:35
Message-ID: 50F6B76F.8000101@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/15/2013 09:16 PM, John R Pierce wrote:
> On 1/15/2013 9:02 PM, Robert James wrote:
>> I would do this as actual databases, but Postgres doesn't allow JOINs
>> and FKs between different databases. Can I use schema for the above?
>> How? How do I backup and restore schema independently?
>
> pg_dump --schema= ...
>
> and drop schema, create schema prior to a restore of a given schema
>
>

Just be aware that a schema only dump has the following restriction:

http://www.postgresql.org/docs/9.2/interactive/app-pgdump.html

-n schema
--schema=schema

Note: When -n is specified, pg_dump makes no attempt to dump any other
database objects that the selected schema(s) might depend upon.
Therefore, there is no guarantee that the results of a specific-schema
dump can be successfully restored by themselves into a clean database.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vraj Mohan 2013-01-16 14:53:39 Sample databases
Previous Message Brian Sutherland 2013-01-16 12:03:27 Re: plpython intermittent ImportErrors