c-function returns multiple rows

From: Kirill Krasnosselov <kirill(at)digicol(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: c-function returns multiple rows
Date: 2003-08-22 11:31:16
Message-ID: 3F45FF04.80700@digicol.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stephan Szabo 2003-08-22 13:17:55 Re: c-function returns multiple rows
Previous Message Josh Berkus 2003-08-22 01:40:09 Re: one-to-one