Forum OpenACS Development: Deleting a user throws errrors
I tried CASCADE but I haven't succeeded. Plus, I know it's not smart, but I'm wondering if removing FK constraints temporarily and swiping the user manually would be a solution.
Is there anything wiser than that?
evex=# delete from acs_objects WHERE object_id = 11531 ;
ERROR: update or delete on table "acs_objects" violates foreign key constraint "parties_party_id_fk" on table "parties"
DETAIL: Key (object_id)=(11531) is still referenced from table "parties".
evex=# select acs__remove_user(11531);
ERROR: update or delete on table "users" violates foreign key constraint "acs_objects_creation_user_fk" on table "acs_objects"
DETAIL: Key (user_id)=(11531) is still referenced from table "acs_objects".
CONTEXT: SQL statement "delete from users
where user_id = delete__user_id"
PL/pgSQL function acs_user__delete(integer) line 7 at SQL statement
SQL statement "SELECT acs_user__delete(remove_user__user_id)"
PL/pgSQL function acs__remove_user(integer) line 16 at PERFORM
it is in general not trivial to completely remove a user. What if, for instance, this was the creator of a forum? Would we want to completely delete this forum also (and all its potentially valuable content)? This is why we don't set any on delete cascade on creation users of an acs_object.
It is usually the case that the portrait is also an acs_object with creation user set to the one the portrait belongs to. Therefore, one must delete it first and then user deletion can happen.
For me it makes sense that one deletes a user expecting its portrait to go away too. Therefore I have addressed this in commit http://cvs.openacs.org/changelog/OpenACS?cs=MAIN%3Aantoniop%3A20170816091820
Hope this helps
That's what I expected. In fact and fortunately, the content created by the user was only the portrait, and I removed all references from content::item.
I guess I know what to do and I'm only afraid to it! :)
Glad you could solve it!