Fixed #21160 -- in_bulk fails on SQLite with more than 999 ids

#21160 is a duplicate of https://code.djangoproject.com/ticket/16426