Postgresql 中文操作指南
SPI_returntuple
SPI_returntuple - 准备将元组作为 Datum 返回
SPI_returntuple — prepare to return a tuple as a Datum
Description
SPI_returntuple 复制上层执行程序上下文中的行,以行类型 Datum 的形式返回它。无需转换返回的指针,只要通过 PointerGetDatum 将其转换为 Datum ,然后返回即可。
SPI_returntuple makes a copy of a row in the upper executor context, returning it in the form of a row type Datum. The returned pointer need only be converted to Datum via PointerGetDatum before returning.
此函数只能在连接到 SPI 时使用。否则,返回 NULL,并将 SPI_result 设置为 SPI_ERROR_UNCONNECTED 。
This function can only be used while connected to SPI. Otherwise, it returns NULL and sets SPI_result to SPI_ERROR_UNCONNECTED.
请注意,此操作应用于声明为返回复合类型的功能。它不用于触发器;对于在触发器中返回已修改的行,请使用 SPI_copytuple 。
Note that this should be used for functions that are declared to return composite types. It is not used for triggers; use SPI_copytuple for returning a modified row in a trigger.