Hello, I have the following problem ( at PostgreSQL 7.3.3 on Red Hat Linux 7.1) with c-functions returning multiple
rows.
Here is a transcript of the test example:
//////////////////////////////////////////
#include <stdlib.h>
#include "postgres.h"
#include "fmgr.h"
#include "nodes/execnodes.h"
PG_FUNCTION_INFO_V1(dc_ftx);
Datum
dc_ftx(PG_FUNCTION_ARGS)
{ ReturnSetInfo* rsi = (ReturnSetInfo *)fcinfo->resultinfo;
rsi->isDone = ExprEndResult;
PG_RETURN_NULL();
}
cd /dot/users/kirill/test_pg_functions
gcc -I/dot/dc4/postgres/postgresql-7.3.3/src/include/ -fpic -c dc_ftx.c
gcc -shared -o dc_ftx.so dc_ftx.o
psql mydb
mydb=# create function dc_ftx(int4) RETURNS SETOF INT4 as '/dot/users/kirill/test_pg_functions/dc_ftx.so' language
'C';
CREATE
mydb=# select dc_ftx(10);
///////////////////////////////////////////
In my opinion this function call shall returns a empty table,
but this call does not end.
I suppose that (rsi->isDone = ExprEndResult) has no effect.
Please help me.
Kirill Krasnosselov