Re: ToDo: pg_backup - using a conditional DROP

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ToDo: pg_backup - using a conditional DROP
Date: 2011-11-21 14:05:12
Message-ID: CAFj8pRC_4tgCVgyHLnGjOZ3j1WkhQ4XvCqx_OhTKc=oQWgrLqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

There is a use case from GoodData's engineer

---
We have many user projects, each project has his own database with
granted permissions.
We use pg_dump with option "--clean" which extends SQL dump with syntax like:
"DROP INDEX tab1_idx1;"
"DROP TABLE tab1;"

When we load such dump into database we get a lot of error messages saying:
"INDEX tab1_idx1 doesn't exists;"
"TABLE tab1 doesn't exists;"

We need "--clean" parameter, because we often need to load dump into
database which is not empty.
On the other hand, we want to get rid of ERROR messages in case some
of tables are missing.

Typically we are need to solve one of following situations:

1, dump user project, restore the data in new project.
Each project, even empty one contains at least table "const".
During load of SQL dump, const table from dump needs to overwrite the
one in database.

2, restore the data in project after fail of previous restoration
E.g. connection lost during restoration, no disc space left on device, ...

3, restore the data in project from backup
For some reason, data in the project are messed up and they need to be
overwritten from backup

Vlada
Vladimír Vacula (GoodData)

---

Regards

Pavel Stehule

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-21 14:52:56 Re: [Review] Include detailed information about a row failing a CHECK constraint into the error message
Previous Message Jan Kundrát 2011-11-21 13:59:59 Re: [Review] Include detailed information about a row failing a CHECK constraint into the error message