Autoincrement compatibility fix

The autoincrement column name is now fetched before doing the insert.