Re: ALTER TABLE -- how to add ON DELETE CASCADE?

From: felix(at)crowfix(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Date: 2006-03-07 22:42:14
Message-ID: 20060307224214.GA21890@crowfix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 07, 2006 at 05:36:37PM -0500, Tom Lane wrote:
> felix(at)crowfix(dot)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(at)crowfix(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Wall 2006-03-08 02:06:30 reindexdb script required in 8.1?
Previous Message Tom Lane 2006-03-07 22:36:37 Re: ALTER TABLE -- how to add ON DELETE CASCADE?