pg
pg copied to clipboard
Recursive delete?
Hi, any idea how to do a recursive delete? e..g for
CREATE TABLE domains (
dom_id serial PRIMARY KEY,
dom_domain int REFERENCES domains(dom_id),
);
The way I would approach this would be adding a hook on AfterDelete
The way I would approach this would be adding a hook on
AfterDelete
Thats a very good idea! You mean BeforeDelete?
A good question would be what do you do if one deletion fails. Perhaps the BeforeDelete might be more appropriate
It should all be in a TX, so I wonder how hooks work with that.
just execute the function that deletes the object with RunInTransaction