> m...@byrney.com writes:
>> The question is: what's the "best practice" way of letting a
>> C/C++-language function hang onto internal state across calls?
>
> A static variable for that is a really horrid idea.  Instead use
> fcinfo->flinfo->fn_extra to point to some workspace palloc'd in the
> appropriate context.  If you grep the PG sources for fn_extra you'll
> find plenty of examples.
>
>                       regards, tom lane
>

Thanks for this.  Out of curiosity, why is a static a bad way to do this?


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to