Re: Disable unique constraint in Postgres - Mailing list pgsql-admin

From Samed YILDIRIM
Subject Re: Disable unique constraint in Postgres
Date
Msg-id CAAo1mbmvoxTcPdBXdAtZ4oPT-kAOouUpKeYDbqbUsJdFc0CsbA@mail.gmail.com
Whole thread Raw
In response to Disable unique constraint in Postgres  (Nikhil Ingale <niks.bgm@gmail.com>)
Responses Re: Disable unique constraint in Postgres
List pgsql-admin
Hi Nikhil,

Important point is why you want to disable a unique constraint.
  • If you want to add some duplicate rows into a table, you try to do something fundamentally wrong.
  • If you want to violate a constraint temporarily or postpone validity checking of a constraint, it is possible. It is called DEFERRABLE. You can delay validation of a constraint until the end of the transaction or until the end of the statement execution. I'm adding links to related documents for more details.

Best regards.
Samed YILDIRIM


On Fri, 25 Nov 2022 at 09:19, Nikhil Ingale <niks.bgm@gmail.com> wrote:
Hi All,
We have an alter command to disable any constraints in the oracle db. Similarly do we have any command to disable the UNIQUE constraint in postgres. Most of the postgres db forum suggests dropping the UNIQUE constraint. But, I don't want to drop the constraint here instead just disable the unique constraint.

Need your inputs on the same.

Regards,
Nikhil Ingale

pgsql-admin by date:

Previous
From: Holger Jakobs
Date:
Subject: Re: Question about cert authentication method.
Next
From: Scott Ribe
Date:
Subject: Re: Disable unique constraint in Postgres