Fixed #13813 -- DatabaseWrapper comparison should not raise error

Ticket: https://code.djangoproject.com/ticket/13813