select function in upgrade