Trying to modify a constraint in PostgresSQL
Posted
by
MISMajorDeveloperAnyways
on Stack Overflow
See other posts from Stack Overflow
or by MISMajorDeveloperAnyways
Published on 2011-11-30T17:35:24Z
Indexed on
2011/11/30
17:49 UTC
Read the original article
Hit count: 228
Postgres is getting quite annoying lately.
I have checked the documentation provided by Oracle and found a way to do this without dropping the table. Problem is, it errors out at modify as it does not recognize the keyword. Using EMS SQL Manager for PostgreSQL.
Alter table public.public_insurer_credit MODIFY CONSTRAINT public_insurer_credit_fk1
deferrable, initially deferred;
I was able to work around it by dropping the constraint using :
ALTER TABLE "public"."public_insurer_credit"
DROP CONSTRAINT "public_insurer_credit_fk1" RESTRICT;
ALTER TABLE "public"."public_insurer_credit"
ADD CONSTRAINT "public_insurer_credit_fk1" FOREIGN KEY ("branch_id", "order_id", "public_insurer_id")
REFERENCES "public"."order_public_insurer"("branch_id", "order_id", "public_insurer_id")
ON UPDATE CASCADE
ON DELETE NO ACTION
DEFERRABLE
INITIALLY DEFERRED;
© Stack Overflow or respective owner