Hmm.. I can't believe I missed that. While that exact macro wouldn't apply in my situation (because I fetch the value from a field in a tuple and not the argument of a function), the underlying concept is the same as what I would need. Now I do not need to feel the wrath of unnecessary memory allocation/deallocation for the non-toasted case. Excellent. Thanks very much!
-Aaron > #define PG_FREE_IF_COPY(ptr,n) \ > do { \ > if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \ > pfree(ptr); \ > } while (0) > > Maybe you can use that or do something similar? > > HTH, > > Joe ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match