Fixed #13813 -- Comparison of DatabaseWrappers doesn't raise errors.

Patch from Lukasz Balcerzak.