Thread
-
Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()
Tom Lane <tgl@sss.pgh.pa.us> — 2025-12-29T19:17:25Z
... oh, one other thought: instead of what you did in InitIndexAmRoutine, we should probably do something like { MemoryContext oldcontext; /* * We formerly specified that the amhandler should return a * palloc'd struct. That's now deprecated in favor of returning * a pointer to a static struct, but to avoid completely breaking * old external AMs, run the amhandler in the relation's rd_indexcxt. */ oldcontext = MemoryContextSwitchTo(relation->rd_indexcxt); relation->rd_indam = GetIndexAmRoutine(relation->rd_amhandler); MemoryContextSwitchTo(oldcontext); } regards, tom lane