Re: pg_restore option --clean

From: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
To: M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_restore option --clean
Date: 2024-02-21 14:00:37
Message-ID: CAA5-nLAvRTdqdpX_M=oWUxdUDcAUKa-PrCS-pbhAeP9KJ5XmKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

But it does not work for the structure
# CONSTRAINT test FOREIGN KEY (id_tab_key) REFERENCES tab(id) ON DELETE
cascade ON UPDATE CASCADE

ERROR: cannot drop table tab because other objects depend on it

Regards,

Fabrice

On Wed, Feb 21, 2024 at 12:47 PM M Sarwar <sarwarmd02(at)outlook(dot)com> wrote:

> Look around for
>
> ALTER TABLE TABLE-NAME
> ADD constraint fk-name foreign key col-name refers to tab-name (
> col-name )
> on UPDATE cascase
> on DELETE CASCADE
> ;
> Good luck,
> Sarwar
>
> ------------------------------
> *From:* Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
> *Sent:* Wednesday, February 21, 2024 4:17 AM
> *To:* pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>
> *Subject:* Fwd: pg_restore option --clean
>
>
>
> Hi,
> 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 helping
> Fabrice
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Guillaume Lelarge 2024-02-21 14:35:14 Re: pg_restore option --clean
Previous Message M Sarwar 2024-02-21 11:47:29 Re: pg_restore option --clean

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2024-02-21 14:30:00 Re: LogwrtResult contended spinlock
Previous Message Andy Fan 2024-02-21 13:20:38 Re: Shared detoast Datum proposal