Make insert_get_id() work with non-auto-incrementing columns.

This should fix #1409.