Re: Constraints/On Delete... - Mailing list pgsql-general

From Boget, Chris
Subject Re: Constraints/On Delete...
Date
Msg-id 4040BBE81A9AD411BD27009027887A7C0431CC@tiger.wild.net
Whole thread Raw
In response to Constraints/On Delete...  ("Boget, Chris" <chris@wild.net>)
Responses Re: Constraints/On Delete...
List pgsql-general

> ALTER TABLE "second" DROP CONSTRAINT "$1";

So the reason mine wasn't working (which looks exactly
like yours) is because there was the above constraint on
the table?  What is the $1?  How can I view the existing
constraints for any particular table?

> ALTER TABLE "second" ADD CONSTRAINT "secondfk"
> FOREIGN KEY (name) REFERENCES "first"("record_num")
> ON DELETE CASCADE;

This worked like a charm!  Thank you very much for your help!

> No. Referential actions are applied on changes to the primary
> key side of the constraint (in this case "first"), so deletes
> from first cause actions on second.

Ok, I just wanted to make sure.  It just looked like it was the
other way around.  Because it appeared that the pointer (the
"references") was going from "second" to "first".  I guess that
when records are deleted from the "first", it asks what tables are
referencing one of it's columns and it's not that it implicitely
already knows..?

Again, thank you for all your help!

Chris

pgsql-general by date:

Previous
From: "Boget, Chris"
Date:
Subject: Re: Constraints/On Delete...
Next
From: Stephan Szabo
Date:
Subject: Re: Constraints/On Delete...