Markus Wanner <markus@bluegap.ch> writes:
> I'm having a hard time using an index scan. So far, I've done quite well
> with ScanKeyInit for equality searches. But now I need to scan an index
> from a given starting point. Something like:
> (x, y, z,...) > (const, const, const,...)
> For the equality operatior, I've used get_sort_group_operators() in
> combination with get_opcode() to pass that on as the sk_func of the scan
> key. I slowly begin to doubt if that's correct at all.
> While it works for equality scans, it does somehow not work for for
> BTGreaterStrategy. What am I missing?
A row comparison (a,b,c) > (x,y,z) means something entirely different
from a>x AND b>y AND c>z; but it sounds like the keys you are creating
define the latter condition.
Look at the RowCompareExpr stuff in nodeIndexscan.c to see how to build
a scankey that means the former.
regards, tom lane