JanWieck@t-online.de (Jan Wieck) writes:
>> (We might need to avoid leaks in the comparison routines that are used
>> for indexes, but otherwise I think this scheme will work comfortably.)
> That sounds bad. At least not very good.
> So we better add a PG_FREEARG_xxx(ptr, argno) macro that does
> the pfree if the pointer is different from the one in the
> argument.
Yes, I already borrowed that idea from your original code. I don't
like it a whole lot, but as long as the need for it is confined to
the indexable comparison operators I think we can tolerate it.
The alternative is to hack up the index search routines (and also
tuplesort.c, and perhaps other places?) to maintain a short-term memory
context for evaluating comparison operators, and reset said context
fairly frequently. That might be doable but I haven't yet looked into
what it would take.
I'm hoping to commit what I have this evening...
regards, tom lane