From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Aram Fingal <fingal(at)multifactorial(dot)com> |
Cc: | Postgres-General General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Alter table to "on update cascade" |
Date: | 2010-11-17 16:43:59 |
Message-ID: | 20101117164359.GE22765@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Nov 17, 2010 at 11:32:32AM -0500, Aram Fingal wrote:
> I have a table where I should have declared a foreign key with ON
> UPDATE CASCADE and didn't. Now I want to fix that. From the
> documentation on www.postgresql.org, about ALTER TABLE it's not at
> all clear how to do this or even whether you can do this.
You can do it like this:
BEGIN;
ALTER TABLE foo DROP CONSTRAINT your_constraint;
ALTER TABLE foo ADD FOREIGN KEY ...;
COMMIT;
Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2010-11-17 16:44:32 | Re: where is pg_stat_activity (and others) in the documentation? |
Previous Message | A.M. | 2010-11-17 16:43:34 | Re: Re: Survey on backing up unlogged tables: help us with PostgreSQL development! |