SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type - Mailing list pgsql-sql

From amul sul
Subject SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
Date
Msg-id 1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com
Whole thread Raw
Responses Re: [NOVICE] SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type  (amul sul <sul_amul@yahoo.co.in>)
List pgsql-sql
Hi ALL,

I need little help, in writing C function returns multiple row. (please find attached c code: show_eudc.c)

I have created table & inserted values in "temp"  as: 

create table temp(id int, value varchar);
insert into temp select x, lpad('string', 10, x::text) from generate_series(1, 10) x;

Just want to return few rows  SELECT * FROM temp using C function;

While  setting funcctx->max_calls = 1 work as expected;  

postgres=# select * from show_eudc();
NOTICE:  call_cntr : 0
 f1 |     f2
----+------------
  1 | 1111string
(1 row)

but setting funcctx->max_calls = 2;(or 4) throws error.

NOTICE:  call_cntr : 0
NOTICE:  call_cntr : 1
ERROR:  rows returned by function are not all of the same row type

I am not getting cause of error, as it working for single call, but why not for multiple call?

Do i missing something?

Thanks in Advance 


P.S. more info:

Loaded C function as:

CREATE OR REPLACE FUNCTION show_eudc(OUT f1 integer, OUT f2 varchar)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'show_eudc'
LANGUAGE C IMMUTABLE STRICT;


Regards,
Amul Sul
Attachment

pgsql-sql by date:

Previous
From: Kumar Babu P G
Date:
Subject: Postgres behavior - Conditional statements
Next
From: Pena Kupen
Date:
Subject: array in function