Re: Table level restore in postgres

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Table level restore in postgres
Дата
Msg-id CANzqJaD+pt75S32hknd7ChrKGR40=kS04ZJyMN0c5RKxNvhz8w@mail.gmail.com
обсуждение исходный текст
Ответ на [MASSMAIL]Table level restore in postgres  (arun chirappurath <arunsnmimt@gmail.com>)
Список pgsql-general
On Thu, Mar 28, 2024 at 2:27 PM arun chirappurath <arunsnmimt@gmail.com> wrote:
Dear all, 

I am a new bie in postgres world....

Suppose I have accidently deleted a table or deleted few rows ,is it safe to drop this table and restore just this table from custom backup to same database?

By "custom backup", do you mean a dump file created by "pg_dump --format=custom"?
 
Or should I create a new database and restore it there and then migrate the data?

What is the general methodology used?

If you backup the database using "pg_dump --format=custom", then yes, you can use 
pg_restore --format=custom --table=${sometable} --database=$yourdatabase

I'd test it first, though, in a scratch database (with scratch tables and scratch data), just to ensure that the command doesn't first drop the database.

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Table level restore in postgres
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Inquiry on Participating in the Korean Translation Project for PostgreSQL Documentation