I have some SPI C functions which dispatch to a selected PostgreSQL function based on the the first argument value. I have 3 questions and am very open to any other advise you might have: 1. If any of the arguments are bigger than a word, e.g. text or arrays, do I need to copy them into upper memory or can I just reuse the Datum value passed to the C function in calling the SQL function? 2. When the returned value is bigger than a word I need to copy it before returning it - is there a way for the SPI C function to do this without having to know the detailed type of the value returned? I'm hoping there might be some handy formula with macros here. 3. I'm doing the calling using saved query plans - this seems to be the only way to call an arbitrary function using the documented SPI API. However, I see other code using undocumented functions to "directly" call PostgreSQL functions from C, which looks easier. I want to use the fastest method possible that will not break with future releases - what do you advise? Thanks for your answers to these questions and thanks for the excellent responses to my earlier questions! Happy New Year, _Greg J. Greg Davidson -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general