Sometimes, when a question gets deleted, not all answers of that question get automatically deleted too. Provided that you can see the deleted question, those answers can still be voted on/..., just like normal answers. This is inconsistent and should be prevented.
Most of the examples seem to fall into two categories:
Questions deleted for being spam/by moderators (just a guess, those questions have no "deleted by" and no record of their deletion in their revision history. Probably that's a bug on it's own):
- https://stackoverflow.com/questions/1987885
- Redirect to new blog using jquery or javascript
- https://stackoverflow.com/questions/1726859
- https://stackoverflow.com/questions/1606685
However those questions got deleted, this action should probably also delete the answers to that question.
Race conditions:
- https://stackoverflow.com/questions/1803977
- https://stackoverflow.com/questions/1809673
- https://stackoverflow.com/questions/1796700
- https://stackoverflow.com/questions/1500325
I would guess the reason for this is some side effect of the "can still post answer after question is closed" grace period (I seem to remember there was such a thing). This grace window should not apply to deleted questions or the posted answers should immediately be marked deleted.
In the latest data dump there were all together >4000 such "undead" answers. To find them the following query can be used:
select
a_parentid as "question id",
count(a_id) as "number of not deleted answers"
from (
select
answers.id as a_id,
answers.parentid as a_parentid,
questions.id as q_id
from
posts as answers left outer join posts as questions
on answers.parentid = questions.id
where
answers.posttypeid = 2
) as subquery
where q_id is NULL
group by a_parentid;
(The query for the real database would probably be simpler since there it should be possible to directly ask if a given question is deleted)
zombie
tag is appropriate here? ;)