agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedSRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
2+ messages / 1 participants
[nested] [flat]
* SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
@ 2014-02-24 06:47 amul sul <sul_amul@yahoo.co.in>
0 siblings, 1 reply; 2+ messages in thread
From: amul sul @ 2014-02-24 06:47 UTC (permalink / raw)
To: pgsql-sql; pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>
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=
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Attachments:
[application/octet-stream] show_eudc.c (2.1K, ../../1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com/2-show_eudc.c)
download
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
@ 2014-02-25 04:59 amul sul <sul_amul@yahoo.co.in>
parent: amul sul <sul_amul@yahoo.co.in>
0 siblings, 0 replies; 2+ messages in thread
From: amul sul @ 2014-02-25 04:59 UTC (permalink / raw)
To: amul sul <sul_amul@yahoo.co.in>; pgsql-sql; pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>
Hi, Finally I fixed it :)
It has issue in sub-sequence call, it looses the result store in values[] @line 84 .
thats why, it successfully return only single row in first call and fails in further call.
It can be fix by preserving results (i.e. values[]).
Thank you !
Regards,
Amul Sul
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-02-25 04:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 06:47 SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type amul sul <sul_amul@yahoo.co.in>
2014-02-25 04:59 ` amul sul <sul_amul@yahoo.co.in>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox