Search Postgresql Archives

Any need to copy args before SPI C function callls SQL function?

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

 



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

[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