Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> Tom Lane wrote:
>> It might work to build the new key in a context that's initially a
>> child of CurrentMemoryContext, then reparent it to be a child of
>> CacheMemoryContext when done.
> That's another way (than the PG_TRY block), but I think it's more
> complicated with no gain.
I disagree: PG_TRY blocks are pretty expensive.
regards, tom lane