Alias joined tables on insert

This fixes inserting values into tables with composite primary keys
with multiple references to the same table in the key.