Forum OpenACS Development: Re: Problem when i tried to delete a user from db (nuke user)

Adding "on delete cascade" is clean and it works, but the problem i have is because not all the columns with "references" constraint have "on delete cascade".

I mean that if you want to 'nuke' a user, some tables have their constraints with "on delete cascade" but others don't have it, for example : parties, persons, users created in (...../packages/acs-kernel/sql/postgresql/community-core-create.sql),  These tables and others like forums_forums and etc don't have "on delete cascade", so in this case "on delete cascade" option doesnt' work, that is the reason I need to use the pg_catalog.

Collapse
Posted by russ m on
Enrique - I realise that just saying we should use "on delete cascade" doesn't solve your immediate problem... crawling through the various pg_ tables to essentially do the cascade yourself is the way to do what you're trying to do right now.

But I think the general solution is to add "on delete cascade" to most FK constraints in OpenACS... as it stands, if you do want to delete from the DB an object that may have had any of OACS's "object generic" services used on it (comments, relations, whatever) you need to manually find everything that's got an FK reference to the object in question and delete them first. In my opinion that's work that the database should be doing (hell, it's *why* "on delete cascade" exists in the SQL spec)...