Fixed #20337 -- Change copy when database relation is not allowed

See https://code.djangoproject.com/ticket/20337