开发者

Returning a table from a UDF (in C)

I'm trying to write a UDF in C that inserts val开发者_Python百科ues into a table and returns this table. The bigger picture is: I parse some document and set up a "parse table" (essentially this is the relational representation of the parse tree of the document parsed). After having inserted the parsing information into the parse table I need the UDF to return this "parse table" as it is needed as input for further operators.

If I use the SPI (SPI_execute) I can insert the data but can't read it out with a subsequent query (e.g. SELECT * from parseTable;) as the result of the subsequent query depends on the query before (at least I understood the manual this way).

I very much appreciate any help. I'm kind of stuck here.

Many thanks in advance,

Dietrich


there are a few samples

  1. postgresqlsrc/contrib/tablefunc/tablefunc.c
  2. http://www.pgsql.cz/index.php/Project_of_UDF_and_its_realization_at_C_for_PostgreSQL#Table_functions
  3. look to PostgreSQL's source code src/backend/utils/misc/guc.c/show_all_settings(), src/backend/utils/adt/misc.c/pg_get_keywords()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜