From: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Table level restore in postgres |
Date: | 2024-03-28 19:41:14 |
Message-ID: | CANzqJaD+pt75S32hknd7ChrKGR40=kS04ZJyMN0c5RKxNvhz8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Mar 28, 2024 at 2:27 PM arun chirappurath <arunsnmimt(at)gmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2024-03-28 20:36:49 | Re: Inquiry on Participating in the Korean Translation Project for PostgreSQL Documentation |
Previous Message | Adrian Klaver | 2024-03-28 19:09:24 | Re: Table level restore in postgres |