Re: Disable unique constraint in Postgres

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
https://www.postgresql.org/docs/15/sql-set-constraints.html
https://www.postgresql.org/docs/15/sql-createtable.html

Best regards.
Samed YILDIRIM


On Fri, 25 Nov 2022 at 09:19, Nikhil Ingale <niks.bgm@xxxxxxxxx> 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

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux