Re: C Set Returning Function (SRF) - Mailing list pgsql-novice

From Tom Lane
Subject Re: C Set Returning Function (SRF)
Date
Msg-id 13911.1315459904@sss.pgh.pa.us
Whole thread Raw
In response to C Set Returning Function (SRF)  (Gary Chambers <gwchamb@gwcmail.com>)
Responses Re: C Set Returning Function (SRF)  (Gary Chambers <gwchamb@gwcmail.com>)
List pgsql-novice
Gary Chambers <gwchamb@gwcmail.com> writes:
> I'm trying to write a simple set returning function that links the GNU pwgen
> code.  I can't seem to pull it together to return the results reliably.
> There are several examples that demonstrate returning tuples, but I can't
> seem to find any examples of SRFs returning single (specifically textual)
> types.  Will someone please offer some insight?

I think the problem is here:

>          SRF_RETURN_NEXT(funcctx, CStringGetDatum(pw));

CStringGetDatum produces a datum of type cstring.  You want a datum of
type text.   PointerGetDatum(cstring_to_text(pw)) ought to do it.

            regards, tom lane

pgsql-novice by date:

Previous
From: Gary Chambers
Date:
Subject: C Set Returning Function (SRF)
Next
From: Carlo Ascani
Date:
Subject: Re: copy- what's my root directory?