From: | "J(dot) Greg Davidson" <jgd(at)well(dot)com> |
---|---|
To: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Any need to copy args before SPI C function callls SQL function? |
Date: | 2009-12-24 21:10:42 |
Message-ID: | 1261689042.7438.17.camel@shevek.puuhonua.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2009-12-24 21:40:39 | Re: Updating from 8.2 to 8.4 |
Previous Message | Alexander Solovkin | 2009-12-24 20:14:38 | Installation problem |