Re: Return setof values from C-function

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Yuriy Rusinov <yrusinov(at)gmail(dot)com>
Cc: POSTGRES <pgsql-general(at)postgresql(dot)org>
Subject: Re: Return setof values from C-function
Date: 2013-12-10 15:57:09
Message-ID: CAHyXU0ykfevyNVXYOzq3hXP2qsAPvBcyFfB-A3Q_nd0CQvXiMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 10, 2013 at 9:44 AM, Yuriy Rusinov <yrusinov(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2013-12-10 16:21:26 Re: DB Audit
Previous Message Yuriy Rusinov 2013-12-10 15:44:32 Re: Return setof values from C-function