Ticket # 14019: SQLInsertCompiler.as_sql() failure

This pull request contains a fix for [ticket #14019](https://code.djangoproject.com/ticket/14019) updated against the latest Django.