Fix error excluding one-to-many using db-generated keys