On 05/31/18 20:20, Charles Cui wrote: > To clarify, I think my question is functions like json_each or > json_object_keys() are > set returning functions ( > https://www.postgresql.org/docs/9.5/static/functions-srf.html), > which means it returns a set of results into a Datum.
Well, it returns one result row as a Datum (either a single value or a tuple) each time it is called, until the whole set has been returned. The process is described here https://www.postgresql.org/docs/9.5/static/xfunc-c.html#XFUNC-C-RETURN-SET (though that description is from the point of view of the set-returning function being called, not the point of view of its caller). -Chap