Pipeline UPSERT SELECT when possible