c-function returns multiple rows - Mailing list pgsql-novice

From Kirill Krasnosselov
Subject c-function returns multiple rows
Date
Msg-id 3F45FF04.80700@digicol.de
Whole thread Raw
Responses Re: c-function returns multiple rows
Re: c-function returns multiple rows
List 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




pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: one-to-one
Next
From: Stephan Szabo
Date:
Subject: Re: c-function returns multiple rows