fix sql select generated id