fix upsert with query expression