Grind the basil, pine nuts and garlic in a mortar with a pestle until the mixture forms a paste. Stir in the cheeses, then slowly add the oil, a little at a time, stirring continuously with a wooden spoon. Alternatively, blend the basil, pine nuts and garlic in a food processor until the mixture forms a paste. Add the cheeses and process briefly, then, with the motor still running, pour in the oil through the feed tube in a thin, steady stream.
Cook the potatoes in a large saucepan of salted boiling water for 5 minutes, then add the pasta and cook according to the packet instructions until al dente. Add the beans 5 minutes before the end of the cooking time.
Drain the pasta and vegetables, reserving 2 tablespoons of the cooking water. Return the cooked pasta and vegetables to the pan and stir in the pesto sauce, adding the reserved water to loosen the mixture. Serve immediately, with some extra grated Parmesan.