SPI_REGI...GGER_DATA(3)
π NAME π
okay bestie, welcome to the SPI_REGI...GGER_DATA(3) page from the PostgreSQL 13.23 Documentation β¨ β the function here is SPI_register_trigger_data, and its whole vibe is making ephemeral trigger data available in SPI queries. periodt.
β¨ SYNOPSIS β¨
int SPI_register_trigger_data(TriggerData *tdata)
π¦ DESCRIPTION π¦
okay so here's the tea: SPI_register_trigger_data makes any ephemeral relations captured by a trigger available to queries planned and executed through the current SPI connection. Currently, this means the transition tables captured by an AFTER trigger defined with a REFERENCING OLD/NEW TABLE AS ... clause. no cap.
This function should be called by a PL trigger handler function after connecting. literally 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. yay, iconic β¨
on error, one of the following negative values is returned instead β not the cute vibes:
SPI_ERROR_ARGUMENTβ iftdataisNULL. bestie, that's not the move πSPI_ERROR_UNCONNECTEDβ if called from an unconnected C function.SPI_ERROR_REL_DUPLICATEβ if the name of any trigger data transient relation is already registered for this connection.
that's the whole page, bestie π«Ά this one is from PostgreSQL 13.23, dated 2025. go register that trigger data and slay πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13-docs 13.23-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