I want to create a psql-C function with an undefined length list of integers (GIDs for example).
An erratic example using V0 function definition that works is like:
int mytest4(int *x, int i){
int *a = &(x[6]);
int j;
for (j = 0; j < i; j++)
printf("Passed on %d", a[j]); // sent to logfile
return a[i];
}
My question concerns the V1 functions to read an int array. I don't understand how to do
PG_FUNCTION_INFO_V1(mytest5);
Datum mytest5(PG_FUNCTION_ARGS){
int *x = PG_GETARG_???(0);
int i = PG_GETARG_INT32(1);
...
Does anyone know how to write the same function, please??