Thread: PG_RESTORE

PG_RESTORE

From
salah jubeh
Date:
Hello,

I hope that I am not wasting your time,  I tried to restore a part of a database and I faced couple of obstacles. First of all, I tried to restore a certain set of schemas without restoring a certain relations. I wanted to do that in order to create some automated dummy data for testing. There is no option in pg_restore to do that so I started to  restore it using the -n and -t options. There are two things, here 
1. When I tried to restore a table which has a dependency I get errors, I think pg_restore can be improved here by having an option to restore the dependencies if they are not existed.
2. when I resetored a table in a certain schema which has a dependency on another table in the public schema, pg restore was not able to find this table (the one in the public schema)  and I get an error.

i.e pg_restore ..... -n schema1 -t table1 ...

error tablex does not exist... (I do not remember the exact format and message) 

My question, is there is an easier way to do that, - I will have a look on pg_dump to see if I can achieve this task by combining both tools. Also, I am wondering if I am doing something wrong here.

Thanks in advance