Re: Problems with pg_dump/restore and OIDs

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Khristian <der(dot)kosak(at)gmail(dot)com>
Subject: Re: Problems with pg_dump/restore and OIDs
Date: 2011-01-20 15:17:03
Message-ID: 201101200717.03691.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 20 January 2011 6:59:08 am Khristian wrote:
> Hi,
> I'm trying to backup a schema in a database which uses OIDs. Using
> pg_dump | psql works fine, but I need to backup it to a file. So I
> tried using pg_dump like this:
> pg_dump -h localhost -U usr -F c -f dump.sql -o -n my_schema -b
> source_db_name And then restoring it with:
> pg_restore -d target_db_name -h localhost -U usr -W -F c dump.sql
> And it always fails when restoring some of the OIDs or because of
> foreign key restrictions.
>
> How can I backup this successfully?
>
> Thanks,
> --
> Khristian Alexander Schönrock

One potential problem is that you are restricting the dump to one schema. From
the docs:

"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. "

Similar issue possibly for the OIDS. Unless you are dumping to an empty database
it is quite possible that the OIDS are already in use.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2011-01-20 15:57:05 Re: rubyrep breaks Silver Stripe (MVC frame work) and vis versa.
Previous Message Khristian 2011-01-20 14:59:08 Problems with pg_dump/restore and OIDs