pg_restore exclude schema from being droped option - Mailing list pgsql-hackers

From Kostis Mentzelos
Subject pg_restore exclude schema from being droped option
Date
Msg-id 45B90617.5080904@gmx.net
Whole thread Raw
Responses Re: pg_restore exclude schema from being droped option  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi list,

I am using pg_dump and pg_restore to backup and restore a database but 
there is something
that I believe is missing from the restore process:
an option in pg_restore to exclude a schema from being dropped when -c 
option is defined.

And here is why:

Suppose that I have a database with about 12 tables of customer data 
(address, notes, configuration ... no more than 10.000 rows each) and 50 
tables of history data (history files with about 1.000.000 rows each).
Now, to backup the database I choose to create 2 scripts, BackupData.sh 
to backup all small tables and BackupHist.sh to backup history tables. 
When I call pg_restore -c to restore data tables, pg_restore report a 
failure because it is trying to drop a schema that it is not empty. So 
it would be very helpful to have an option to exclude the schema (for 
example: public) from being dropped.

I now that I there are some alternatives for example: pg_restore -l, 
comment out the drop schema line and pg_restore -L or put data tables 
and hist tables into separate schemas but an option to pg_restore would 
be a lot easier, I guess.

What do you thing?

regards,
Kostis Mentzelos


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: VC2005 build and pthreads
Next
From: BluDes
Date:
Subject: PostgreSQL Data Loss