  The article investigates the question of under what conditions a functor
between small categories preserves cohomology groups when passing to the
inverse image. For example, it is known that the left adjoint functor preserves
the category cohomology with local coefficients or the category cohomology
constructed as derived of the limit functor. We give counterexamples showing
that the left adjoint functor may not preserve the Baues-Wirsching,
Hochschild-Mitchell, and Thomason cohomology. To solve the arising problems, we
propose necessary and sufficient conditions for the invariance of these types
of cohomology under the transition to the inverse image of a functor between
small categories. Moreover, we generalize these cohomology of small categories
and find similar criteria for the obtained generalization.
