If we are going to change that portion of the code, we may as well go a bit forward and allow any expressions to be fetched from a foreign server (obviously, if that server is capable of doing so). It will help, when we come to aggregate push-down or whole query push-down (whenever that happens). So, instead of attr_needed, which restricts only the attributes to be fetched, why not to targetlist itself?