Re: [GENERAL] c function return not recognized?
От | Gene Selkov Jr. |
---|---|
Тема | Re: [GENERAL] c function return not recognized? |
Дата | |
Msg-id | 199912120635.AAA29334@mail.xnet.com обсуждение исходный текст |
Ответ на | c function return not recognized? (Frank Miles <fpm@u.washington.edu>) |
Список | pgsql-general |
Frank Miles wrote: > I've got an external C function that I call from a SELECT, for example: > > select * from <table> where <cond1> and CFunction(columnName) > 1.0; > > The 'CFunction' has been installed into Postgreql using CREATE FUNCTION, > with a single 'text' argument, and returning a float8 (i.e. double). This is becoming a VFAQ, which is nice because it means that the extensibility features gain popularity (which IMO make postgres stand out very impressively), but it is disturbing that the message in the docs and in examples is not getting through. One can't get anything back from a C function by other means than reference. One needs to first palloc() the space for the value and then return the pointer to it. The reason Frank's function behaved as he describes is likely because the caller treats the return values as pointers which indeed points to random locations depending on the input. There could be other reasons, too, but then again, it is always helpful to paste a bit of your code so we don't have to speculate about the exact nature of your problem. --Gene
В списке pgsql-general по дате отправления: