agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: amul sul <sul_amul@yahoo.co.in>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
To: pgsql-novice@postgresql.org <pgsql-novice@postgresql.org>
Subject: SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
Date: Mon, 24 Feb 2014 14:47:28 +0800 (SGT)
Message-ID: <1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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=
--
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
view thread (2+ messages) latest in thread
Message-ID: <1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com>
Permalink: ../1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com/
Also on: postgresql.org/message-id/1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sul_amul@yahoo.co.in, pgsql-novice@postgresql.org
Subject: Re: SRF_RETURN_NEXT Error: rows returned by function are not all of the same row type
In-Reply-To: <1393224448.45554.YahooMailNeo@web193503.mail.sg3.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox