From: | Samed YILDIRIM <samed(at)reddoc(dot)net> |
---|---|
To: | Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: Disable unique constraint in Postgres |
Date: | 2022-11-27 16:51:39 |
Message-ID: | CAAo1mbmvoxTcPdBXdAtZ4oPT-kAOouUpKeYDbqbUsJdFc0CsbA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
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(dot)bgm(at)gmail(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2022-11-27 16:58:54 | Re: Disable unique constraint in Postgres |
Previous Message | Holger Jakobs | 2022-11-27 08:47:57 | Re: Question about cert authentication method. |