On Sat, 2006-11-25 at 01:36 -0500, Tom Lane wrote:
> The solution that's been used so far is a static variable known to
> the caller and the hash/comparison functions; see for instance
> CurTupleHashTable in executor/execGrouping.c
Ah, fair enough -- that should work.
> (Right offhand it sounds like you might be reinventing execGrouping.c
> --- what is your application exactly?)
I'm playing around with writing a memoization facility as a UDF:
cache(f, a1, a2, ...) = f(a1, a2, ...), except that cache() keeps an
internal hash of f()'s return values and uses that to avoid calling f()
when possible. Hence the need for a hash table whose keys are (a1,
a2, ...).
-Neil