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

From: David Fetter <david(at)fetter(dot)org>
To: Jim Nasby <jnasby(at)pervasive(dot)com>
Cc: felix(at)crowfix(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: ALTER TABLE -- how to add ON DELETE CASCADE?
Date: 2006-03-08 22:09:10
Message-ID: 20060308220910.GB26074@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 08, 2006 at 04:06:55PM -0600, Jim Nasby wrote:
> 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.

Well, except in the sense of dropping and re-creating them inside a
transaction :)

Cheers,
D (transactional DDL is fantastic :)
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2006-03-08 22:13:10 Re: reindexdb script required in 8.1?
Previous Message Jim Nasby 2006-03-08 22:06:55 Re: ALTER TABLE -- how to add ON DELETE CASCADE?