SPI_REGI...GGER_DATA(3)
πΈ NAME πΈ
okay so bestie, this is the SPI_REGI...GGER_DATA(3) page β yes, the truncated name is giving main-character energy, iykyk β and the function weβre hyping is SPI_register_trigger_data. it makes ephemeral trigger data available in SPI queries. periodt. β¨
β¨ SYNOPSIS β¨
int SPI_register_trigger_data(TriggerData *tdata)
π DESCRIPTION π
so SPI_register_trigger_data makes any ephemeral relations captured by a trigger available to queries planned and executed through the current SPI connection. no cap. π¦
currently, this means the transition tables captured by an AFTER trigger defined with a REFERENCING OLD/NEW TABLE AS ... clause. thatβs the specific vibe rn.
this function should be called by a PL trigger handler function after connecting. like, connect first, then call it β thatβs the assignment, bestie. π
π ARGUMENTS π
TriggerData *tdataβ theTriggerDataobject passed to a trigger handler function asfcinfo->context. thatβs the one you hand over. π«Ά
π RETURN VALUE π
if the execution of the command was successful, then the following (nonnegative) value will be returned:
SPI_OK_TD_REGISTERβ if the captured trigger data (if any) has been successfully registered. slay, it worked. π
on error, one of the following negative values is returned:
SPI_ERROR_ARGUMENTβ iftdataisNULLSPI_ERROR_UNCONNECTEDβ if called from an unconnected C functionSPI_ERROR_REL_DUPLICATEβ if the name of any trigger data transient relation is already registered for this connection
bestie, those error returns are negative values β not the vibe we want, but now you know exactly what they mean. π
mwah π thatβs the whole page, from the PostgreSQL 16.15 documentation, dated 2026 β catch u at the bottom of the man page, bestie π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16-docs 16.15-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms