Forum OpenACS Development: delete acs_attribute

Collapse
Posted by Iuri Sampaio on
i want to remove an acs_attribute by using the following query:

delete from acs_attributes where attribute_name = 'contact_id';

as expected i got the error:
ERROR: update or delete on table "acs_attributes" violates foreign key constraint "dtype_attributes_fk" on table "dtype_attributes"
DETAIL: Key (attribute_id)=(157) is still referenced from table "dtype_attributes".

and the contraint is:
ADD CONSTRAINT dtype_attributes_fk FOREIGN KEY (attribute_id)
REFERENCES acs_attributes (attribute_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;

I already tried to use on cascade as in:

delete cascade from acs_attributes where attribute_name = 'contact_id';

how do i delete the record without having to force by dropping the constraint

Collapse
2: Re: delete acs_attribute (response to 1)
Posted by Don Baccus on
I'd guess you're supposed to call "acs_attribute__drop_attribute" rather than try to do it yourself.