Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()
Date
Msg-id 2992607.1767035845@sss.pgh.pa.us
Whole thread Raw
In response to Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
... 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()
Next
From: Kirill Reshke
Date:
Subject: Re: [PATCH] Fix escaping for '\' and '"' in pageinspect for gist