We study the geometric properties of holomorphic distributions of totally null m-planes on a (2m+ϵ)-dimensional complex Riemannian manifold (M,g), where ϵ∈{0,1} and m≥2. In particular, given such a distribution N, say, we obtain algebraic conditions on the Weyl tensor and the Cotton–York tensor which guarantee the integrability of N, and in odd dimensions, of its orthogonal complement. These results generalise the Petrov classification of the (anti-)self-dual part of the complex Weyl tensor, and the complex Goldberg–Sachs theorem from four to higher dimensions.Higher-dimensional analogues of the Petrov type D condition are defined, and we show that these lead to the integrability of up to 2m holomorphic distributions of totally null m-planes. Finally, we adapt these findings to the category of real smooth pseudo-Riemannian manifolds, commenting notably on the applications to Hermitian geometry and Robinson (or optical) geometry.