Re: pg_restore option --clean
От | Guillaume Lelarge |
---|---|
Тема | Re: pg_restore option --clean |
Дата | |
Msg-id | CAECtzeX9w6LZt5shybtEuHAS5aJXRWfCw9sTK5vOp0DSxjvE3Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pg_restore option --clean (Fabrice Chapuis <fabrice636861@gmail.com>) |
Ответы |
Re: pg_restore option --clean
|
Список | pgsql-admin |
Hi,
Le mer. 21 févr. 2024 à 15:01, Fabrice Chapuis <fabrice636861@gmail.com> a écrit :
But it does not work for the structure# CONSTRAINT test FOREIGN KEY (id_tab_key) REFERENCES tab(id) ON DELETE cascade ON UPDATE CASCADEERROR: cannot drop table tab because other objects depend on it
Yeah, ON DELETE and ON CASCADE are not the answer to your question.
pg_restore won't drop objects in cascade. There's no option for that. I'd guess the reason is that --clean only cleans the object it will restore. If other objects depend on it, pg_restore has no way to know how to recreate them, and you would end up with a not completely restored database.
Regards.
Regards,FabriceOn Wed, Feb 21, 2024 at 12:47 PM M Sarwar <sarwarmd02@outlook.com> wrote:Look around forALTER TABLE TABLE-NAMEADD constraint fk-name foreign key col-name refers to tab-name ( col-name )on UPDATE cascaseon DELETE CASCADE;Good luck,SarwarFrom: Fabrice Chapuis <fabrice636861@gmail.com>
Sent: Wednesday, February 21, 2024 4:17 AM
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Fwd: pg_restore option --cleanHi,The --clean option of pg_restore allows you to replace an object before being imported. However, dependencies such as foreign keys or views prevent the deletion of the object. Is there a way to add the cascade option to force the deletion?Thanks for helpingFabrice
--
Guillaume.
В списке pgsql-admin по дате отправления: