Re: C Function Memory Management - Mailing list pgsql-general

From Tom Lane
Subject Re: C Function Memory Management
Date
Msg-id 10079.1355330654@sss.pgh.pa.us
Whole thread Raw
In response to Re: C Function Memory Management  (Martin French <Martin.French@romaxtech.com>)
Responses Re: C Function Memory Management  (Martin French <Martin.French@romaxtech.com>)
List pgsql-general
Martin French <Martin.French@romaxtech.com> writes:
> So out of curiosity, what would be your approach for data preservation
> cross call?

Usually I'd allocate the space in fcinfo->flinfo->fn_mcxt (which is a
query-lifespan context) and keep a pointer to it in
fcinfo->flinfo->fn_extra (which is a void * field that a C function
can do what it pleases with).  There are plenty of examples in the
Postgres source code.  If you are looking to cache data longer than
one query then it takes more thought.

            regards, tom lane


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Columns defined not matching pg_attibute
Next
From: Mihai Popa
Date:
Subject: Re: large database