MDL-24666 sync_users.php can throw db exception on sites upgraded from 1.x