Postgresql 中文操作指南

SPI_freetuptable

SPI_freetuptable — 释放由 SPI_execute 或类似函数创建的行集

SPI_freetuptable — free a row set created by SPI_execute or a similar function

Synopsis

void SPI_freetuptable(SPITupleTable * tuptable)

Description

SPI_freetuptable 释放由先前的 SPI 命令执行函数创建的行集,例如 SPI_execute 。因此,该函数常常与全局变量 SPI_tuptable 一起作为参数调用。

SPI_freetuptable frees a row set created by a prior SPI command execution function, such as SPI_execute. Therefore, this function is often called with the global variable SPI_tuptable as argument.

此函数在 SPI 使用的 C 函数需要执行多条命令,并且不想在该函数结束之前保留早期命令的结果时很有用。请注意,任何未释放的行集都将在 SPI_finish 释放。此外,如果在执行 SPI 使用的 C 函数,然后中止子事务,SPI 将自动释放子事务运行时创建的任何行集。

This function is useful if an SPI-using C function needs to execute multiple commands and does not want to keep the results of earlier commands around until it ends. Note that any unfreed row sets will be freed anyway at SPI_finish. Also, if a subtransaction is started and then aborted within execution of an SPI-using C function, SPI automatically frees any row sets created while the subtransaction was running.

在 PostgreSQL 9.3 中开始, SPI_freetuptable 包含防护逻辑,用于防止对同一行集发出重复的删除请求。在早期版本中,重复删除会导致崩溃。

Beginning in PostgreSQL 9.3, SPI_freetuptable contains guard logic to protect against duplicate deletion requests for the same row set. In previous releases, duplicate deletions would lead to crashes.

Arguments

  • SPITupleTable * _tuptable_

    • pointer to row set to free, or NULL to do nothing