Gary Chambers <gwchamb(at)gwcmail(dot)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