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
- postgresqlsrc/contrib/tablefunc/tablefunc.c
- http://www.pgsql.cz/index.php/Project_of_UDF_and_its_realization_at_C_for_PostgreSQL#Table_functions
- look to PostgreSQL's source code src/backend/utils/misc/guc.c/show_all_settings(), src/backend/utils/adt/misc.c/pg_get_keywords()
精彩评论