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

From: Jim Nasby <jnasby(at)pervasive(dot)com>
To: felix(at)crowfix(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Date: 2006-03-08 22:06:55
Message-ID: 8BAC97D6-8205-42C9-90C2-374E31B4DBAB@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mar 7, 2006, at 4:42 PM, felix(at)crowfix(dot)com wrote:

> 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.

Yeah, unfortunately there's no support for modifying constraints.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2006-03-08 22:09:10 Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Previous Message Nik 2006-03-08 21:51:55 Re: Out of memory error on pg_restore