Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Basically, this comment and code in genam.c:
> ...
> is wrong, because it assumes that there's only one scankey per index
> column, but that's not true for toast_fetch_datum_slice(), which uses
> two scankeys for the chunkid, to fetch a range. Attached is a patch to
> fix that, as suggested in the comment. Comments? I'll apply if not..
Huh, can't believe I missed that that caller might use non-sequential
column numbers.
It's kind of annoying to introduce a search when it's so seldom needed,
though. How about something like
/* fast path for common case */if (key[i].sk_attno == irel->rd_index->indkey.values[i]) key[i].sk_attno = i + 1;else
... search as you have it ...
regards, tom lane