Is it possible to make a compiled C function take an array as an argument? Right now I've got a function that takes 32 arguments, all declared as separate variables (int arg1, int arg2, ...) and it would be a lot more natural for the function to be called with an array (int *array, int num_elements). Is this possible? Also, how do I return an SQL NULL from a function? Thanks, Kyle
Kyle <kaf@nwlink.com> writes:
> Is it possible to make a compiled C function take an array as an
> argument?
Sure, although disassembling the array is not quite trivial (a Postgres
array is not the same as a C array). In the 7.1 code, there is a
deconstruct_array() function in src/backend/utils/adt/arrayfuncs.c
that will help.
> Also, how do I return an SQL NULL from a function?
In 7.0, you don't. In 7.1, see src/backend/utils/fmgr/README.
regards, tom lane
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера