Edmund Horner <ejr...@gmail.com> writes: > For the forward scan, I seem to recall, from your merge join example, > that it's useful to set the pathkeys even when there are no > query_pathkeys. We just have to unconditionally set them so that the > larger plan can make use of them.
No. Look at indxpath.c: it does not worry about pathkeys unless has_useful_pathkeys is true, and it definitely does not generate pathkeys that don't get past truncate_useless_pathkeys. Those functions are responsible for worrying about whether mergejoin can use the pathkeys. It's not tidpath.c's job to outthink them. regards, tom lane