Thread: How to remove contraint

How to remove contraint

From
Vernon Wu
Date:
I have been trying to remove a foreign key contraint from a table with any success. I had a look at the docuemnt, the 
command should be something like

ALTER TABLE mytable DROP CONTRAINT contraiint

What the "contraint" shall be if the table has "Triggers: RI_ConstraintTrigger_16613"?

Thanks 




Re: How to remove contraint

From
"Christopher Kings-Lynne"
Date:
You can't drop foreign keys using the DROP CONSTRAINT command.  If you read
the docs properly, you'll see that that is mentioned.  You will have to
manuall drop all three triggers involved in the FK constraint.  (2 on the
parent relation and 1 on the child)

Yes, this is a big deficiency in Postgres, but it's tricky to implement and
no-one's gotten around to it yet.

Chris

> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Vernon Wu
> Sent: Wednesday, 12 June 2002 3:58 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] How to remove contraint
>
>
>
> I have been trying to remove a foreign key contraint from a table
> with any success. I had a look at the docuemnt, the
> command should be something like
>
> ALTER TABLE mytable DROP CONTRAINT contraiint
>
> What the "contraint" shall be if the table has "Triggers:
> RI_ConstraintTrigger_16613"?
>
> Thanks
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>