I tested the patch. Basically all of my test cases passed. Just a few small comments:
+ if (subkey->sk_attno > firstchangingattnum) /* >, not >= */ + break; Can we enhance the comment to something like ">, not >= because firstchangingattnum starting from 1". + /* + * Compare the last tuple's datum for this row compare member + * (unless we already know that lasttup must satisfy qual) + */ + if (!lastsatisfied) + { When subkey->sk_attno <= firstchangingattnum, if first is not satisfied, then last should not be satisfied either, so we can skip check last. The new status of this patch is: Waiting on Author