First, I am not an electrician, so you will need to verify your installation meets your local codes.
It comes down to the rules of the NEC (National Electric Code) rules. There is a specific line in the code that says the cord shall not exceed 3 feet in length. NEC expects that a dedicated GFCI protected outlet is installed to run the pool pump (and no extension cords). You don't mention it, but outlets have to be a certain distance away from pool walls as well, 5 feet I believe.
Also, you shouldn't use an extension cord between the outlet and the pump. Extension cords are not meant to be used as a permanent installation. You really should have a dedicated GFCI protected outlet installed to run the pool pump. Have a timer installed as well to help you save $$$ on electricity.
Call your local code enforcement office. They are there to answer questions as well.