| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Markus Wanner <markus(at)bluegap(dot)ch> | 
| Cc: | PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Index scan troubles | 
| Date: | 2008-09-02 18:03:39 | 
| Message-ID: | 16843.1220378619@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Markus Wanner <markus(at)bluegap(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2008-09-02 18:06:18 | Re: Mysterious Bus Error with get_fn_expr_argtype() | 
| Previous Message | Neil Conway | 2008-09-02 17:52:12 | Re: Window functions patch v04 for the September commit fest |