Re: Return setof values from C-function - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Return setof values from C-function
Date
Msg-id CAHyXU0ykfevyNVXYOzq3hXP2qsAPvBcyFfB-A3Q_nd0CQvXiMA@mail.gmail.com
Whole thread Raw
In response to Re: Return setof values from C-function  (Yuriy Rusinov <yrusinov@gmail.com>)
Responses Re: Return setof values from C-function
List pgsql-general
On Tue, Dec 10, 2013 at 9:44 AM, Yuriy Rusinov <yrusinov@gmail.com> wrote:
> I have added code
>
>         Oid * oids = (Oid *)palloc (2*sizeof (Oid));
>         oids[0] = INT8OID;
>         oids[1] = FLOAT8OID;
>         if (get_call_result_type(fcinfo, oids, &tupdescRes) !=
> TYPEFUNC_COMPOSITE)
>             ereport(ERROR,
>                     (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
>                      errmsg("function returning record called in context "
>                             "that cannot accept type record")));
>
> and try to obtain tupdescRes  from get_call_result_type function, before
> this I do
>
> create type hist_point as (inum bigint, bin float8);
>  and
> create or replace function histogram (varchar, float8, float8, int4) returns
> setof hist_point
>     as '$libdir/libfloader.so', 'histogram' language 'c' strict security
> definer;
>
> but the result does not obtained.

what error are you getting?  Also, I think you are not properly
initializing NULLs array -- that could be your issue.

merlin


pgsql-general by date:

Previous
From: Yuriy Rusinov
Date:
Subject: Re: Return setof values from C-function
Next
From: bricklen
Date:
Subject: Re: DB Audit