Search Postgresql Archives

Re: Maintaining state across function calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



matt@xxxxxxxxxx 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


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux