Independent backups of subdatabases

Started by Robert Jamesabout 13 years ago3 messagesgeneral
Jump to latest
#1Robert James
srobertjames@gmail.com

I'd like to organize tables into different groups. This is for 3 reasons:

1. Each group needs to be backed up and restored independently from the others
2. Each group has different permissions for particular users
3. As an aid to human understanding organization

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?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2John R Pierce
pierce@hogranch.com
In reply to: Robert James (#1)
Re: Independent backups of subdatabases

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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: John R Pierce (#2)
Re: Independent backups of subdatabases

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.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general