Lists: | pgsql-generalpgsql-hackers |
---|
From: | Rich Doughty <rich(at)opusvl(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Adding ON UPDATE CASCADE to an existing foreign key constraint |
Date: | 2006-05-04 15:18:01 |
Message-ID: | 445A1B29.8010803@opusvl.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers |
I have a foreign key constraint that I'd like to alter. I'd rather not
drop and re-create it due to the size of the table involved. All I need
to do is add an ON UPDATE CASCADE.
Is it ok to set confupdtype to 'c' in pg_constraint (and will this be
all that's needed) or is it safer to drop and recreate the constraint?
PG Version 8.0.3
Thanks a lot
- Rich Doughty
From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Rich Doughty <rich(at)opusvl(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Adding ON UPDATE CASCADE to an existing foreign key |
Date: | 2006-05-04 16:17:31 |
Message-ID: | 20060504091559.H56325@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers |
On Thu, 4 May 2006, Rich Doughty wrote:
> I have a foreign key constraint that I'd like to alter. I'd rather not
> drop and re-create it due to the size of the table involved. All I need
> to do is add an ON UPDATE CASCADE.
>
> Is it ok to set confupdtype to 'c' in pg_constraint (and will this be
> all that's needed) or is it safer to drop and recreate the constraint?
I don't think that's going to work, you'd probably need to change the
function associated with the trigger involved too. It's probably safer to
do the drop and create.
From: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | Rich Doughty <rich(at)opusvl(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [GENERAL] Adding ON UPDATE CASCADE to an existing foreign key |
Date: | 2006-05-04 20:38:25 |
Message-ID: | 20060504203825.GE97354@pervasive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers |
Moving to -hackers...
On Thu, May 04, 2006 at 09:17:31AM -0700, Stephan Szabo wrote:
> On Thu, 4 May 2006, Rich Doughty wrote:
>
> > I have a foreign key constraint that I'd like to alter. I'd rather not
> > drop and re-create it due to the size of the table involved. All I need
> > to do is add an ON UPDATE CASCADE.
> >
> > Is it ok to set confupdtype to 'c' in pg_constraint (and will this be
> > all that's needed) or is it safer to drop and recreate the constraint?
>
> I don't think that's going to work, you'd probably need to change the
> function associated with the trigger involved too. It's probably safer to
> do the drop and create.
It would be nice if there was a way to do this that didn't involve
re-validating all the data. Can this be added as a TODO?
--
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
From: | Rich Doughty <rich(at)opusvl(dot)com> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Adding ON UPDATE CASCADE to an existing foreign key |
Date: | 2006-05-05 08:53:49 |
Message-ID: | 445B129D.8090405@opusvl.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers |
Stephan Szabo wrote:
> On Thu, 4 May 2006, Rich Doughty wrote:
>
>
>>I have a foreign key constraint that I'd like to alter. I'd rather not
>>drop and re-create it due to the size of the table involved. All I need
>>to do is add an ON UPDATE CASCADE.
>>
>>Is it ok to set confupdtype to 'c' in pg_constraint (and will this be
>>all that's needed) or is it safer to drop and recreate the constraint?
>
>
> I don't think that's going to work, you'd probably need to change the
> function associated with the trigger involved too. It's probably safer to
> do the drop and create.
ok, thanks.
--
- Rich Doughty