SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type

From: amul sul <sul_amul(at)yahoo(dot)co(dot)in>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
Date: 2014-02-24 06:47:28
Message-ID: 1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice 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 Content-Type Size
show_eudc.c application/octet-stream 2.1 KB

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Aditya Rastogi 2014-02-24 06:51:58 getting ERROR: stack depth limit exceeded on a WHERE IN query on a view
Previous Message Thomas Kellerer 2014-02-23 19:42:48 Re: One PostgreSQL server for multiple apps?

Browse pgsql-sql by date

  From Date Subject
Next Message Pena Kupen 2014-02-24 08:42:20 array in function
Previous Message Kumar Babu P G 2014-02-24 06:37:24 Postgres behavior - Conditional statements