Обсуждение: Cascade constraint gone!!!

Поиск
Список
Период
Сортировка

Cascade constraint gone!!!

От
Linh Luong
Дата:
Hi,

I recently wipe my database away.  And some of the tables have a UPDATE
CASCADE on it to another table.  
When I reload the data from my backup that I did with pg_dumpall.  My
code started to give me an error because I tried to modify a table that
was reference from another table.  But the referenced table should have
an UPDATE CASCADE.  But according to the error it doesn't. 

Is there a way to add the ON UPDATE CASCADE back without dropping any
table again?

Thanks


-- 
Linh Luong


Re: Cascade constraint gone!!!

От
Stephan Szabo
Дата:
On Wed, 6 Jun 2001, Linh Luong wrote:

> I recently wipe my database away.  And some of the tables have a UPDATE
> CASCADE on it to another table.  
> When I reload the data from my backup that I did with pg_dumpall.  My
> code started to give me an error because I tried to modify a table that
> was reference from another table.  But the referenced table should have
> an UPDATE CASCADE.  But according to the error it doesn't. 

Hmm, what does the create constraint triggers in the dump say?  And what
is in pg_trigger for the constraint?

> Is there a way to add the ON UPDATE CASCADE back without dropping any
> table again?

Well, you can manually delete the constraint triggers for this
constraint and use alter table add constraint to add the constraint again
with the appropriate actions.