Re: ALTER TABLE -- how to add ON DELETE CASCADE? - Mailing list pgsql-general

From felix@crowfix.com
Subject Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Date
Msg-id 20060307224214.GA21890@crowfix.com
Whole thread Raw
In response to Re: ALTER TABLE -- how to add ON DELETE CASCADE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ALTER TABLE -- how to add ON DELETE CASCADE?
List pgsql-general
On Tue, Mar 07, 2006 at 05:36:37PM -0500, Tom Lane wrote:
> felix@crowfix.com writes:
> >     ALTER TABLE A COLUMN AA ADD CONSTRAINT DELETE ON CASCADE
>
> You're missing the specification of the foreign key, not to mention
> spelling the CASCADE clause backwards.  Try
>
> ALTER TABLE A ADD FOREIGN KEY(AA) REFERENCES B(BB) ON DELETE CASCADE

Got it right in the Subject: and my many attempts, just not in the
body :-)

The column already had the foreign key, I never thought to add it
again.  I was only thinking of modifying the minimum necessary.

Thanks.

--
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
     Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
  GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Next
From: David Wall
Date:
Subject: reindexdb script required in 8.1?