A bug was introduced a while ago by this patch:
commit 447f7364dd7227a32b58a2aff24f587dd7d7051a
Author: Tom Lane [EMAIL PROTECTED]
Date: Sat Apr 12 23:14:21 2008 +
Create new routines systable_beginscan_ordered,
systable_getnext_ordered,
systable_endscan_ordered that have
Heikki Linnakangas [EMAIL PROTECTED] 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
Tom Lane wrote:
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
...