when you say delete everything do you also mean tags too?
btw your table for the join could be rewritten as this:
create table post_tag (post_id int references post on delete cascade, tag_id int references tag on delete cascade, primary key (post_id, tag_id));
Here's a simple example using a cascade delete, with also a trigger
https://gist.github.com/dharrigan/7d5c6474cd56f0a17922f106c9968036
btw, it's a bit dangerous, in the sense that if you delete a post, that references a tag, that then references another post, then that post will be removed too.
you probably either want to put a restrict in, or remove the cascade delete on the tag 🙂
(and let the trigger do the delete for you)
@dharrigan yes, but its just curiousity - I think the real answer is the trigger