The links explain exceptions, court of law can be one of the exceptions, or a doctor may plead physician patient confidentiality just as an advocate may plead attorney client confidentiality or a husband may plead spousal confidentiality in some jurisprudence (in the US a husband can legally abstain from giving evidence that is wife incriminating and the wife vice versa)
As in many things in law, the facts of the individual case are arguable in determining which applies and which does not apply.
But in this case, there was no court of law rationale/exception.
It is not fair to the deceased, not only out of the legal angle presented above, but also out of common human decency.
Senator Byrd would say "Barbaric, barbaric, baaarbaaaric".