I'm not sure this is a good idea, because the epq_path will return at most one tuple in an EPQ recheck.
The reason why an extra Sort node is injected into the epq_path is only label it with the correct sort order to use it as an input for the EPQ merge-join path of a higher-level foreign join, so shouldn't we keep this step as much as simple and save cycles even a little?
Agreed. Thanks for the explanation. I also wondered whether it's worthwhile to do the change here. I'll remove the 0001 patch.